I think you mean options with multiple values [1], rather than positional parameters. In particular look at the examples for --coordinates and --rgbcolor.
[1] http://search.cpan.org/dist/Getopt-Long/lib/Getopt/Long.pm#Options_with_multiple_values
Barbie
Leader of Birmingham Perl Mongers...
Hopefully the following will clarify what you want:
#!/usr/bin/perl -w
use strict;
my $string = '(<arg1> || <arg2> && (<arg3>))';
$string =~ s/<(.*?)>/check_arg($1)/g; # global string replace
print "$string\n"; # prints '(check_arg(arg1) || check_arg(arg2) && (check_arg(arg3)))'
$string =...
Take a look at the perldoc page for eval [1]. There is a difference between an expression and a block form of eval. You are using the expression form, but really want the block form.
[1] http://perldoc.perl.org/functions/eval.html
my $firstname='Robert';
eval { sub {get_lastname($firstname);}...
You're misunderstanding what eval does. eval returns a result, however what you are after is a code-ref:
my $coderef = sub { print };
&$coderef; # this executes the code
eval { &$coderef }; # this executes the code safely
See perlref [1] for further details.
[1]...
Any reason why you're not using the Perl core module, File::Path [1] and its mkpath() function? It gives you a lot more control over the directory creation.
#!/usr/bin/perl -w
use strict;
use File::Path;
my $dir='C:\Documents and Settings';
mkpath($dir);
[1]...
Have a look at Time::HiRes [1], that can go down to nanoseconds.
[1] http://search.cpan.org/dist/Time-HiRes/HiRes.pm
Barbie
Leader of Birmingham Perl Mongers
http://birmingham.pm.org
Please note that 'XHeaders' are not supported by MS Outlook.
As to your problem, is this other script running from a CGI script? If so then the user that you are trying to access MS Outlook with may not be the same user as that for the command line script.
MS Outlook is very temperamental when...
I personally use Getopt::Long [1], which offers a lot more flexibility.
[1] http://search.cpan.org/dist/Getopt-Long/lib/Getopt/Long.pm
Barbie
Leader of Birmingham Perl Mongers
http://birmingham.pm.org
I think this is one of those times you are falling foul of the Unicode problem. If you are using anything before Perl 5.8, you'll need to use the utf8 module (1)
(1) http://search.cpan.org/~nwclark/perl-5.8.6/lib/utf8.pm
If you're able to upgrade to 5.8.4 or higher, then the Unicode support is...
dmazzini, you point out some very good reasons for and against, for which you get a *.
However, the Spreadsheet modules were never written to complement the full Excel experience. If you wanted to be able to read fomulas, then you either use Excel, or rewrite the VBA engine (which isn't really...
The original poster was also the one that posted today too ;-)
Just because someone mentions they are having trouble with a particular module, doesn't mean they can't be told another way. Especially if it gives them another avenue to think about in the future.
The code he posted today works...
I am really surprised no-one has pointed you at the following great modules:
1) Spreadsheet::ParseExcel
2) Spreadsheet::TieExcel
3) Spreadsheet::WriteExcel
These are much easier to use than relying on the Win32::OLE module. The latter is actually used by Vodafone to create Excel binaries on...
mike, you are quite right. That's what comes of thinking aloud and not testing. Bad Barbie, no biscuit! However, you're solution of check for adjacent commas is probably the simplest of the lot :-)
Regarding warnings and strictures. If you talk to most experienced Perl programmers, particularly...
What version of Perl are you running? It sounds like the version you have isn't compatible with the PPD files that your copy of PPM has found. It might be worth adding a few extra repositories. For this try the following scripts I usually use.
The first (ppm-install1.pl) installs the...
That won't work, if you assign a value, then override it with undef, it'll still be undef. You'll want something like:
foreach $dev (@device) {
my @fields = split (/,/, $dev);
my $log_name = $fields[0] || next;
my $type = $fields[1] || next;
my $uis_fstatus...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.