On Friday, June 14, 2002, at 07:38 , Batchelor, Scott wrote:
> In Perl:
>
> $var = @ARGV;
>
> print "$var";
>
> By just printing the $var to STDOUT in perl should give me the $returnvar.
print the @ARGV would have shown you all that was passed.
Think about the symantical problem here - you just pushed
the COUNT of @ARGV into $var.... not the first item....
The following code may help you better understand arrays
which is what @ARGV happens to be...
#!/usr/bin/perl -w
use strict;
my @array = qw/ var1 thing2 thing3/;
my $var = @array ;
print "\$var is $var\n\t the \@array is @array\n";
my $max_item = $#array;
print "Hum \$max_item is $max_item - which is not $var\n";
my $i=0;
while ($i <= $max_item) {
print "We have item at \$array[$i] as: $array[$i]\n";
$i++;
}
Perlsonally I would do the 'what did I get from the command line'
with something like Getop::Long or Getopt::Std - since that will
allow you more flexibility in the long run...
Since what you want to do is 'manage' the things passed to
you on the command line....
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]