in reply to Cannot print line

Maybe this is what you intended.
#!perl use strict; use warnings; my $infile = "trec7_4collections.txt"; open IN, '<', $infile or die "Could not open $infile $!"; my @rows = <IN>; close IN; print $rows[0];

Replies are listed 'Best First'.
Re^2: Cannot print line
by ww (Archbishop) on Nov 28, 2014 at 14:55 UTC

    Re poj's contribution -- it works (and, ++ for following the OP's code while correcting it). But it seems unnecessarily complicated in comparison with suggestions in prior answers. On the face of the OP's problem, there's no need to use an array here.




    If you didn't program your executable by using mechanical switches to toggle-in the binary, it wasn't really programming!

Re^2: Cannot print line
by nimpoura (Initiate) on Nov 29, 2014 at 18:17 UTC
    Thanks a lot!!