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

getting the error.. Name 'main::FILE" used only once: possible typo at line 9 Use of uniniitalized value in concatenation <.> or string and Attemping line: 302 Moved Temporarily not sure what that means

Replies are listed 'Best First'.
Re^3: Where did I go wrong?
by andreas1234567 (Vicar) on Nov 14, 2007 at 06:29 UTC
    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
      /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.