in reply to Can you guess the result? Is it a bug?
hmmm.. what am I doing wrong here? (perl, v5.8.0 built for i686-linux)
]$ perl -wMstrict -e"if( my($test) = 0 ) { print 'Passed'; } else { pr +int 'Failed'; }" Can't declare stub in "my" at -e line 1, near ") =" Execution of -e aborted due to compilation errors. ]$ perl -wMstrict -e"if( my($test) = '' ) { print 'Passed'; } else { p +rint 'Failed'; }" Can't declare stub in "my" at -e line 1, near ") =" Execution of -e aborted due to compilation errors. ]$ perl -wMstrict -e"if( my($test) = undef ) { print 'Passed'; } else +{ print 'Failed'; }" Can't declare stub in "my" at -e line 1, near ") =" Execution of -e aborted due to compilation errors. ]$ perl -wMstrict -e "if( my $test = undef ) { print 'Passed'; } else +{ print 'Failed'; }" syntax error at -e line 1, near "my =" Execution of -e aborted due to compilation errors.
I had to swap "/' to get it to run..
]$ perl -wMstrict -e 'if( my ($test) = undef ) { print "Passed"; } els +e { print "Failed"; }' Passed ]$ perl -wMstrict -e 'if( my $test = undef ) { print "Passed"; } else +{ print "Failed"; }' Failed
cheers,
J
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Can you guess the result? Is it a bug?
by The Mad Hatter (Priest) on Jul 31, 2003 at 03:47 UTC | |
by Cine (Friar) on Jul 31, 2003 at 13:31 UTC | |
|
Re: Re: Can you guess the result? Is it a bug?
by BrowserUk (Patriarch) on Jul 31, 2003 at 03:45 UTC |