[ILUG] perl question

kevin lyda kevin+dated+1031483357.745a24 at ie.suberic.net
Tue Sep 3 12:09:22 IST 2002


On Tue, Sep 03, 2002 at 11:54:36AM +0100, John P. Looney wrote:
>  In some code, when I do:
>     tie(%foo, "DB_File", "$stats_file", O_RDONLY, 0666, $DB_HASH);
>     print "$_ ", $foo{"RECEIVED:smtp"}, "\n";
>  I get
>     93

is that what you want?

>  printed out. I want to be able to replace RECIEVED:smtp with "$ARGV[0]".

ok, that's just:

     print "$_ ", $foo{$ARGV[0]}, "\n";

dunno what the $_ is for.  and i'd be more inclined to type:

     print("$_ ". $foo{$ARGV[0]}. "\n");

and you know $ARGV[0] is not equal to c's argv[0], right?  it's equal
to c's argv[1].  c's argv[0] is $0 in perl (which is a shell-ism).

kevin

-- 
kevin at suberic.net     that a believer is happier than a skeptic is no more to
fork()'ed on 37058400    the point than the fact that a drunken man is happier
meatspace place: home       than a sober one. the happiness of credulity is a
http://ie.suberic.net/~kevin   cheap & dangerous quality -- g.b. shaw




More information about the ILUG mailing list