Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Save first n values from a file

by Lennotoecom (Pilgrim)
on Jan 10, 2014 at 12:16 UTC ( [id://1070105]=note: print w/replies, xml ) Need Help??


in reply to Save first n values from a file

this is the dark arts ^ ^,
but seriously, I think other monks won't approve, still:
for $x (f .. j){ chomp(${$x} = <DATA>); } print "$f $g $h $i $j\n"; __DATA__ a b c d e
update*
addressing the authors exact demands
here an addition:
do{for $x (i, g, k){ chomp(${$x} = <DATA>); } print "$i $g $k\n";} until eof; __DATA__ a b c d e f g h
output:
a b c d e f g h

Replies are listed 'Best First'.
Re^2: Save first n values from a file
by LanX (Saint) on Jan 10, 2014 at 12:28 UTC
    > I think other monks won't approve, still:

    Don't you think, you should at least mention no strict 'refs' ? :)

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      yes, sorry
      just couldn't restrain myself :)
      I hope the readers will understand

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2024-04-25 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found