in reply to Problem in passing multiple argument through command line
This seems to be more an shell issue than a Perl issue. You need to properly quote arguments that contain whitespace in your command line:
perl report.pl -CustomerName "Penelope NY" > test.txt
As a matter of style, I recommend using Getopt::Long, possibly together with Pod::Usage to create the command-line handling parts for scripts. A detailed discussion is at The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan!, by PodMaster.
With that, your command line would have to look like this:
perl report.pl --CustomerName "Penelope NY" > test.txt
And the command line handling code in your program would be:
use strict; use Getopt::Long; use Pod::Usage; GetOptions( 'CustomerName' => \my @customers, ... ); for my $customer (@customer) { print "Hello $customer!\n"; };
|
|---|