in reply to Passing HASH values to a abc.pl file from command line
#!Perl ... # storing data in %a, $c, @d # in your script like this @d=(10,11,12,132); $c="Hello!"; %a=(first => 1, second => 2); ... while(@ARGV){ my $param=shift; if($param=~/\$/){ print "Variable $param=".eval "$param"; }elsif($param=~/\@/){ print "Array $param=\n".join("\n",eval "$param"); }elsif($param=~/\%/){ my %tmp=eval "$param"; print "Keys of hash $param=\n".join("\n", keys %tmp); }else{ print "Param error =)"; } print "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Passing HASH values to a abc.pl file from command line
by Ananda (Pilgrim) on Dec 04, 2002 at 04:52 UTC | |
by BrowserUk (Patriarch) on Dec 04, 2002 at 12:35 UTC | |
by Ananda (Pilgrim) on Dec 04, 2002 at 12:57 UTC | |
by cmapuk (Novice) on Dec 04, 2002 at 11:47 UTC |