I have a hex string (length 48 chars) that I want to convert to raw bytes with the pack function in order to put it in a Win32 vector of bytes.
How I can do this with Perl?
Using the Perlmodule Net::Telnet, how do you send an arrow key to a telnet session so that it would be the same thing as a user pressing the down key on the keyboard?
use Net::Telnet;
my $t = new Net::Telnet();
my $down_key=?; #How do you send a down key in a telnet session?
t->print($down_key);
I am trying to get yahoo options data into mysql using perl. I found modules to download stock prices, but not options data. Anyone know what would be the easiest way to do that? If I have to roll my own, what modules should I use?
Thanks,
CP
In perl suppose I have a string like 'hello\tworld\n', and what I want is:
'hello world
'
That is, "hello", then a literal tab character, then "world", then a literal newline. Or equivalently, "hello\tworld\n" (note the double quotes).
In other words, is there a function for taking a string with escape sequences and returning an equivalent string with all the escape sequences interpolated?
I just want to transfer (send or receive) a hash from client to server.
Can you tell me which is a preferable way in Perl or can you suggest any CPAN modules?
I want to use perl's sprintf to zerofill a variable.
sprintf("%08d", $var);
but I want the dynamically determine how many digits to zero fill.
How do I replace the "8" in sprintf("%08d", $var) with a variable called $zerofill.
Thanks.
I do have a whole bunch of files in a directory and from every file I want to remove the first line (including carriage return). I can read the whole file into an array of strings and write all but the first element to a new file, but that looks a bit cumbersome to me are there better ways? Oh the prefered language is Perl.
I'm sort of new to Perl and I'm wondering if there a prefered unit testing framework?
Google is showing me some nice results, but since I'm new to this, I don't know if there is a clear preference within the community.
I have a computationally expensive task in perl, and would like to inform the user that computation is ongoing by printing out a period after each portion of the computation is completed. Unfortunately, until I print a "\n", none of my periods are printed. How can I address this?
How do I comment a part of a single line in Perl?
like the following line:
if($clevel==0){#never happends}
i would like to be able to comment that last closing bracket, without going to a new line.
I am trying to extract data from a website using PERL. Below is the description of the site:
site displays data dependent on a date
a calendar is displayed that is used to change the date
upon clicking the dates in the calendar, it calls a javascript function that passes in the date and refreshes the part of the page that displays the data
My question is, how do I execute that JS function so that I could loop through the dates that I need data from?
Thanks in Advance
For Example in shell script:
_CLASSPATH =.
for jar in lib/*.jar
do
_CLASSPATH=${_CLASSPATH}:${jar}
done
How can I dynamically build a Java classpath in Perl?
Perl code fragment:
my $export = $doc;
$export =~ s:\.odt:\.pdf:;
How would this be written cleaner? Not simply what are 900 other ways to write it, TMTOWTDI.
I am a newbie to perl. My problem is...
I have a relative path
$base_path = input/myMock.TGZ
The filename can change. But the path is always stored in $base_path.
I need to check if the file exists in $base_path.
Any suggestions are helpful to me
Perl code fragment:
my $export = $doc;
$export =~ s:\.odt:\.pdf:;
How would this be written cleaner? Not simply what are 900 other ways to write it, TMTOWTDI.
I have a Perl script that requires the user to enter a password. How can I echo only '*' in place of the character that the user types, as they type it?
I'm using Windows XP/Vista.
Could someone provide a good documentation / tutorial/ PDFs/ reference to book link about Net::Pcap in addtion to the module documentation and
this Perl and Net::Pcap article on PerlMonks?
I have daemon script written in Perl that checks a database tables for rows, pulls them in one by one, sends the contents via HTTP post to another service, then logs the result and repeats (only a single child). When there are rows present, the first one is posted and logged immediately, but every subsequent one is delayed for around 20 seconds. There are no sleep()'s running, and I can't find any other obvious delays. Any ideas?
What is the best way to achieve sscanf-like functionality in perl?
I am looking now looking at the sscanf module,
Which is better,
Option-1: Going sscanf way?
Option-2: Regex way? [I am a beginner when it comes to Regex]
If a string in Perl 5 passes looks_like_number, it might as well be a number. For instance,
my $s = "10" + 5;
results in $s being assigned 15.
Are there any cases where a string does not behave like it's numeric equivalent would have?
Could you please give me some suggestions on how to parse HTML in Perl? I plan to parse the keywords(including URL links) and save them to a MySQL database. I am using Windows XP.
Also, do I first need to download some website pages to the local hard drive with some offline Explorer tool? If I do, could you point me to a good download tool?
If I am in some library code, how do I determine the path to the file of the code that is currently executing? I know how to get the path of the top perl file by looking at ARGV, but if I load a library, how can that library know which path it is at?
Currently I monitoring a particular file with a simple shell one-liner:
filesize=$(ls -lah somefile | awk '{print $5}')
I'm aware that Perl has some nice modules to deal with Excel files so the idea is to, let's say, run that check daily, perhaps with cron, and write the result on a spreadsheet for further statistical use.
I need to validate a Perl hash of hash element such as $Table{$key1}{$key2} exist and defined. Here is what i do. (i have no idea key1 even exist)
if
((defined $Table{$key1}) &&
(exists $Table{$key1}) &&
(defined $Table{$key1}{$key2}) &&
(exists $Table{$key1}{$key2}))
{
#do whatever
}
Is there an easier and cleaner way to do it?