What does this line do in Perl?
my @parsedarray = ($rowcol =~ m/([A-Z]?)([0-9]+)/);
$rowcol is something like A1, D8 etc... and I know that the script somehow splits them up because the next two lines are these:
my $row = $parsedarray[0];
my $col = $parsedarray[1];
I just can't see what this line does ($rowcol =~ m/([A-Z]?)([0-9]+...
What's the difference between my ($variableName) and my $variableName in Perl? What to the parentheses do?
...
Is there any standard way to use integers of arbitrary length in Perl? I am working on code that generates x64 assembly for tests, and I'm tired of manipulating 32 bits at a time.
I'm using Perl 5.10.0, for what it's worth.
...
Hi, I'm new to Perl but need to use it on a project I'm working on. What I need to do is check to see if a URL has a 301 redirect and if it has, get the location. The following told me the code but not the location:
use strict;
use warnings;
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->ma...
I know the perl one liner below is very simple, works and does a global substitution, A for a; but how do I run it in a makefile?
perl -pi -e "s/a/A/g" filename
I have tried (I now think the rest of the post is junk as the shell command does a command line expansion - NOT WHAT I WANT!) The question above still stands!
APP = $(shell p...
I'm learning to add GUI to my Perl program using Win32::GUI. Now I can change the icon of a Win32 title bar using something like:
$myicon = new Win32::GUI::Icon('myicon.ico');
$myclass=new Win32::GUI::Class(
-name=>'myclass',
-icon=>$myicon,
);
$mydialogbox = new Win32::GUI::DialogBox(
-name => 'my...
I've set up a log file to pick up MySQL slow queries.
I've been unable to parse the file however. Linux makes this task seem very simple. In tutorials it seems as easy as:
$ mysqldumpslow -s c -t 10
In Windows however, I'm not sure how you run Perl, located in: G:\xampp\perl\bin with the Perl Script mysqldumpslow.pl, located in: G:\...
How can I store entire contents of an array to a scalar variable.
eg:
my $code = do { local $/; <FILE HANDLE>; };
This works fine for file handles but I need this for an array.
...
I tried to placed ${date[0]} in my directory which is equivalent to 01252010 but @hits not printed. How can I managed to open the directory to get the desired output? Thanks.
ERROR:
Unsuccessful open on filename containing newline at ./total.pl line 11, line 1.
#!/opt/perl/bin/perl -w
use strict;
open(FH,"/home/daily/scripts/sms_...
What is a Perl regex that can replace select text that is not part of an anchor tag? For example I would like to replace only the last "text" in the following code.
blah <a href="http://www.text.com"> blah text blah </a> blah text blah.
Thanks.
...
^\s*[)]*\s*$ and ^\s*[(]*\s*$ matches the parentheses ( and ) which are bold. That is, what am trying is to ignore parentheses that are single and not (condition1) parentheses:
while
( #matches here
( #matches here
(condition1) && (condition2) &&
condition3
) ||
(#matches here
(condition4) ||
...
I have a datas et and like to do a simple while operation with a Perl script.
Here is a small extraction from the dataset:
"number","code","country","gamma","X1","X2","X3","X4","X5","X6"
1,"DZA","Algeria","0.01",7.44,47.3,0.46,0,0,0.13
2,"AGO","Angola","0.00",6.79,"NULL",0.21,1,0,0.28
3,"BEN","Benin","-0.01",7.02,38.9,0.27,1,0,...
I parse a text file with the script below.
How to insert the array data to MySQL table?
I already learned Perl MySQL DBI connect method. And I can connect to local MySQL DB successfully. I can create the table with MySQL command line.
#!C:\Perl\bin\perl.exe
use strict;
use warnings;
while ( <DATA> ) {
my @rocks = split(/\s+/, ...
I have a matrix that I want to randomize a couple of thousand times, while keeping the row and column totals the same:
1 2 3
A 0 0 1
B 1 1 0
C 1 0 0
An example of a valid random matrix would be:
1 2 3
A 1 0 0
B 1 1 0
C 0 0 1
My actual matrix is a lot bigger (about 600x600 items), so I really nee...
Can somebody please tell me how to fire-and-forget a process in Perl? I've already looked at ruby: how to fire and forget a subprocess? for doing the same in Ruby.
...
Does Perl have a Perl Docs generator? Something like Java Docs or PHP Documenter?
...
A Perl idiom for removing duplicate values from an array:
@uniq = keys %{{map{$_=>1}@list}}
Is it cheaper to use this version:
@uniq = keys %{{map{$_=>undef}@list}}
I tested it with these one-liners, and seems that it is true on some versions of Perl:
perl -e 'my %x; $x{$_} = 1 for 0..1000_000; system "ps -ovsz $$"'
perl -e 'my ...
Hello, is there a way to make this work?
(write the out_file to my home-directory)
#!/usr/bin/perl
use warnings;
use strict;
use File::Spec::Functions;
use File::HomeDir;
use DBI;
my $database = 'my_db';
my $table = 'my_table';
my $user = 'user';
my $passwd = 'password';
my $dbh = DBI->connect( "DBI:mysql:$database;",
$user, $passwd,...
I am looking for some examples/advice on how to write a Perl script to read data from an excel file then use the data read in (as a string hopefully) and pass it to another Perl file (as an argument).
The goal is to have a table in which the user can type some data (ftp destination or filename) into the table. Then my program will grab...
I'm using this from the command line:
perl -MDateTime::Format::DateManip -le 'print $Some::Module::VERSION'
but only return a blank line, any thoughts?
...