in reply to Re: Reading DIR content and printing it
in thread Reading DIR content and printing it

Thanks, And why would I not get output, when there is no "\" ?
open file, "< readfile.txt"; @filecontent = <file>; for $f (@filecontent){ print "$f \n" ; } close file;

Replies are listed 'Best First'.
Re^3: Reading DIR content and printing it
by Corion (Patriarch) on Jul 17, 2011 at 11:36 UTC

    In addition to checking for errors, $f has a newline at its end. Again, if you had used warnings, Perl would have told you so:

    Unsuccessful open on filename containing newline at -e line 1.

    Also, when printing out values, always put delimiters around them so you see whitespace:

    print "[$f]\n";
Re^3: Reading DIR content and printing it
by happy.barney (Friar) on Jul 17, 2011 at 11:20 UTC
    check for errors:
    open file, "< readfile.txt" or die "Unable open file: $!";