Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: File Reading

by jwkrahn (Abbot)
on Oct 01, 2007 at 13:43 UTC ( [id://641886]=note: print w/replies, xml ) Need Help??


in reply to File Reading

$ echo "AGE:EYES:HAIR 32:BLUE:BLONDE 54:BROWN:BROWN" | \ perl -F: -lane' BEGIN { $key = uc shift } if ( $. == 1 ) { @x{ map uc, @F } = 0 .. $#F } else { print $F[ $x{ $key } ] } ' age 32 54 $ echo "AGE:EYES:HAIR 32:BLUE:BLONDE 54:BROWN:BROWN" | \ perl -F: -lane' BEGIN { $key = uc shift } if ( $. == 1 ) { @x{ map uc, @F } = 0 .. $#F } else { print $F[ $x{ $key } ] } ' eyes BLUE BROWN $ echo "AGE:EYES:HAIR 32:BLUE:BLONDE 54:BROWN:BROWN" | \ perl -F: -lane' BEGIN { $key = uc shift } if ( $. == 1 ) { @x{ map uc, @F } = 0 .. $#F } else { print $F[ $x{ $key } ] } ' hair BLONDE BROWN

Replies are listed 'Best First'.
Re^2: File Reading
by svenXY (Deacon) on Oct 01, 2007 at 14:15 UTC
    Hi,
    ++jwkrahn for reminding me of the precious $.!
    Regards,
    svenXY

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://641886]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-23 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found