Basic question
am 18.01.2006 10:39:15 von Bernard
Hi,
I just start with perl .
I try to open a file with this :
open(FAN, "< fan.txt");
while () {
print "line $ \n"
}
close(FAN);
when I run it , I have this message :
line1: syntax error near unexpected token 'FAN,'
Do you know what is the issue ?
Thanks
B./
Re: Basic question
am 18.01.2006 13:43:33 von Paul Lalli
bernard wrote:
> Hi,
> I just start with perl .
>
> I try to open a file with this :
>
> open(FAN, "< fan.txt");
> while () {
> print "line $ \n"
> }
>
> close(FAN);
>
> when I run it , I have this message :
> line1: syntax error near unexpected token 'FAN,'
>
> Do you know what is the issue ?
>
DO NOT MULTI-POST!!
If you *need* to post to more than one newsgroup, post ONE message,
putting both newsgroups in the To: line. Do not post two separate but
identical messages to two different newsgroups!
The other thread is over here...
http://groups.google.com/group/comp.lang.perl.misc/browse_fr m/thread/17f091202f028ad7/f4da3f7e4011ea30#f4da3f7e4011ea30
Re: Basic question
am 24.01.2006 13:49:28 von Ronny Mandal
On Wed, 18 Jan 2006 10:39:15 +0100, "bernard"
wrote:
>Hi,
>I just start with perl .
>
>I try to open a file with this :
>
>open(FAN, "< fan.txt");
>while () {
>print "line $ \n"
>}
>
>close(FAN);
>
>when I run it , I have this message :
>line1: syntax error near unexpected token 'FAN,'
Just a suggestion, but have you tried to omit the comma?
i.e
open(FAN "< fan.txt");
>
>Do you know what is the issue ?
>
>Thanks
>
>B./
>
RM
Re: Basic question
am 24.01.2006 14:51:18 von Paul Lalli
Ronny Mandal wrote:
> On Wed, 18 Jan 2006 10:39:15 +0100, "bernard"
> wrote:
>
> >open(FAN, "< fan.txt");
> >while () {
> >print "line $ \n"
> >}
> >
> >close(FAN);
>
> Just a suggestion, but have you tried to omit the comma?
>
> open(FAN "< fan.txt");
>
Because the OP should be causing *more* syntax errors than he already
had?
Why on earth would you suggest such a thing? Do you program by the
"throw it at the wall and see what sticks" method? That is a poor way
to program.
perldoc -f open
Read. Learn.
Paul Lalli
Re: Basic question
am 24.01.2006 20:16:52 von Tintin
"Ronny Mandal" wrote in message
news:bh8ct15m5egk7qntpgmoj9qn7t7kvebupn@4ax.com...
> On Wed, 18 Jan 2006 10:39:15 +0100, "bernard"
> wrote:
>
> >Hi,
> >I just start with perl .
> >
> >I try to open a file with this :
> >
> >open(FAN, "< fan.txt");
> >while () {
> >print "line $ \n"
> >}
> >
> >close(FAN);
> >
> >when I run it , I have this message :
> >line1: syntax error near unexpected token 'FAN,'
>
> Just a suggestion, but have you tried to omit the comma?
Obviously you didn't even try your own bad suggestion. If you had, you
wouldn't have wasted your time posting an answer that leads to more errors.
Programming by guessing is never going to be a reliable method.