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