I have a Perl code which goes to particular website and extracts the required data from it. I face a problem if I lose my connection: the script stops functioning. How could I make the Perl script resume the connection and start the process from where the interruption took place? Can I use the Perl to resume the connection if so could an...
I am getting the result "File not found " when I run the script:
use File::Basename;
my @dirs = grep { fileparse($_) =~ /^[L|l]ib/ }
split /\n/, dir e:\\/ad/b/s;
print @dirs;
This is my actual code. I am trying to grep the directories and subdirectories which have the name lib or Lib in the whole drive.
...
I'm not really sure what to call these type of expressions, so an example would be easier...
Is there a way in Perl to evaluate expressions like a < b <= c? I have a configuration file that allows the user to provide conditional expressions for certain actions. Rather than splitting the condition into two parts (as I would normally do...
I have to pass two references as arguments to a subroutine (buildRanges) as hash key-value pairs as show below
Example:
@array = (“0A0”, “005”, “001”, “004”, “0BC”, “004”, “002”, “001”);
@ranges = ();
$numRanges = buildRanges(VALUES => \@array, REF_RANGES=>\@ranges);
My question is
1. is the syntax for the sub-routine call above is...
Possible Duplicates:
Should I learn Perl, and why?
When should I use Perl CGI instead of PHP (or vice versa)?
Background
I'm currently working as a web developer and have knowledge of HTML, CSS, PHP, MySQL, JavaScript (mainly through jQuery) and Ajax.
I recently entered into the world of Flash and ActionScript and came across ...
I would like to ask my system administrator to install various Perl modules such as Moose and Data::Alias. The system is Red Hat Enterprise Linux 5, running Perl 5.8.8. The only problem that I can think of is that some already-installed modules might need to be upgraded and thus run the risk of breaking something. What else should I be c...
How can I find all the files that match a certain criteria (-M, modification age in days) in a list of directories, but not in their subdirectories?
I wanted to use File::Find, but looks like it always goes to the subdirectories too.
...
Is there any Perl module for recording mp3 files specially on Win32?
If yes could someone provide an example.
...
So I have an array and a simple function that trims white spaces:
my @ar=("bla ", "ha 1")
sub trim { my $a=shift; $a =~ s/\s+$//; $a}
Now, I want to apply this to an array with the map function. Why can't I do this by just giving the function name like one would do with built in functions?
E.g. You can do
print map(length,@ar)
b...
I'm looking for a way to set up some helper methods from within a parent Moose class, rather than a standalone utility class. If it is possible, it would be a more transparent way of adding Moose sugar to modules, as it does not require explicitly requiring any helper modules (as everything would come via the extends declaration).
Based...
Hello:
I was following one of the thread to run perl scripts from my c# program.
My c# code is like this:
private void RunScript(ArrayList selectedScriptFileList)
{
foreach (var curScriptFileName in selectedScriptFileList)
{
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("perl.exe");
...
For a number of web-applications I need something like Capistrano to automate deployment. I know Capistrano can be used to deploy non-ruby applications but I'm not familiar with Ruby, so I expect writing deployment configurations can be a bit of a pain.
So I was wondering, are there any alternatives to Capistrano written in either Perl ...
Hi,
I found Determining the network connection link speed
and now I am trying to correlate the data from Win32_PerfRawData_Tcpip_NetworkInterface with
Win32_NetworkAdapter (or Win32_NetworkAdapterConfiguration).
On the class Win32_PerfRawData_Tcpip_NetworkInterface I don't see any
index or unique key that I can use to reference
Win32_...
The docs for qr/STRING/ say:
This operator quotes (and possibly compiles) its STRING as a
regular expression.
What worries me is the part in parentheses. I can't think of any cases where I don't want it to compile a regex out of STRING. Is this parenthetical statement just weasel words to cover some future case where compiling ...
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?
...
Are there any prerolled streaming statistics libraries for Perl à la: http://en.wikipedia.org/wiki/Algorithms%5Ffor%5Fcalculating%5Fvariance#On-line%5Falgorithm
I haven't found anything on CPAN yet and I really don't want to have to code one myself.
...
Lets say I have a chat program that every time someone sends a message, a globalfile is locked and written to. The receiving client has a pending xmlhttp request that is waiting to return with the newly updated file using this construct:
while (!hasNewdata())
{ sleep 3; }
print "$thenewdata";
sub hasNewData()
{
# determine if...
Which regular expression can I use to find all strings bar are not preceded by string foo? Having whitespace between the two is also illegal.
So the regex should match the following strings
foo is bar
hello bar
But not these
foobar
foo bar
I've tried using the following
(?!<foo)bar
and it gets the work done for eliminating ...
I have a Perl script that reads a command file and restarts itself if necessary by doing:
myscript.pl:
exec '/home/foo/bin/myscript.pl';
exit(0);
Now, this works fine except for one issue. The thread that reads the command file does not have access to the DBI handle I use. And over a number of restarts I seem to build up the number o...
I have three integers:
($r, $g, $b) = (255, 128, 0);
I would like to print a string like:
"#FF8000"
using those variables.
How do I do this?
...