Click to See Complete Forum and Search --> : PERL: whats wrong with this?


RedOctober
10-09-2001, 11:42 AM
open (MYFILE, "/home/me/file/");

I get a error "unquoted string MYFILE may clash with future use of FYFILE "

what give?

YaRness
10-09-2001, 11:46 AM
can you post the rest of the script?

also you prolly want to do
open (whatver) or die "could not open ..."
as a general precaution for when Something Bad Happens.

mangeli
10-09-2001, 11:53 AM
Besides the fact that it is posted in General Linux Questions instead of Programming?

Maybe it should be

open(MYFILE,"/home/me/file");

with out the trailing slash that makes the file a directory?

RedOctober
10-09-2001, 12:59 PM
the complete script is

#!/usr/bin/perl -w

open (MYFILE, "/home/me/file") || die;

however it does not open the file but instead say " main::MYFILE used only once, possibe typo at line 3"

YaRness
10-09-2001, 03:29 PM
well my first guess is you mispelled something.

as for your last post, if the program just those lines, you are opening a file without doing anything with it. try adding a "close MYFILE" at the end and the interpreter should quit *****ing about it. but i think there's more to your script, and you mispelled something somewhere.

also i recommend adding a "use strict;" and "use warnings;" at the beginning of your scripts.

[ 09 October 2001: Message edited by: YaRness ]