in reply to Re^2: Where did I go wrong?
in thread Where did I go wrong?

You probably want something like
use strict; use warnings; my $FILE = undef; my $filename = 'C:\tmp\blah.txt'; open( $FILE, '<', $filename ) or die "Can't open $filename: $!"; while(<$FILE>) { ... } close $FILE or die "Close failed";
See perlopentut for more.

Also, it looks like you are running Win32. /tmp/blah.txt is not a proper Win32 filename.

Update: Thanks to cdarke for pointing out Win32 filename subtleties, where /tmp/blah.txt indeed is a possibly filename.

--
Andreas

Replies are listed 'Best First'.
Re^4: Where did I go wrong?
by cdarke (Prior) on Nov 14, 2007 at 10:43 UTC
    /tmp/blah.txt is not a proper Win32 filename.

    Works for me. It expects a directory called tmp on the current 'drive' (partition). mkdir tmp creates it. The problem with using backslashes as a directory separator is that you then MUST use single quotes around them, or 'escape' them. It is an easy mistake to put the filename inside double quotes. / is much safer, and works on Windoze happily.