Originally posted by Christian:
How do I get a variable from the parameters I start the Perl code with? Like "perlscrip.pl parameter" and i want "parameter" to get in $variable.
@ARGV is the global variable that contains all the arguments passed from the command line. You can display them as:
Code:
#!/usr/bin/perl -w
use strict;
die "No command line arguments given.\n" if(!@ARGV);
for(0..$#ARGV) {
print $_ . " $ARGV[$_]\n";
}
------------------
TheLinuxDuck
Wait... that's a penguin?!?!?
:wq