Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

(unless) usage

by Lhamo_rin (Friar)
on Jun 30, 2003 at 13:12 UTC ( [id://270159]=perlquestion: print w/replies, xml ) Need Help??

Lhamo_rin has asked for the wisdom of the Perl Monks concerning the following question:

Can someone tell me why the following code would give me a syntax error on the Label line?
sub open_file { my $success = open RF, "/bin/.saved_points" unless ($succeed) { my $fail = MainWindow->new(): $fail->Label(-text => "File Failed to open")-> pack(); } }

Replies are listed 'Best First'.
Re: (unless) usage
by particle (Vicar) on Jun 30, 2003 at 13:14 UTC
    my $success = open RF, "/bin/.saved_points"; ## missing semi-colon

    also, you set success, but check succeed in the next line. are you using warnings? or strict? it might help.

    ~Particle *accelerates*

Re: (unless) usage
by broquaint (Abbot) on Jun 30, 2003 at 13:15 UTC
    You're missing a semi-colon on the 2nd line
    my $success = open RF, "/bin/.saved_points" <-- needs a semi-colon
    Also the 4th line has a colon instead of a semi-colon
    my $fail = MainWindow->new(): <-- should be a ;

    HTH

    _________
    broquaint

Re: (unless) usage
by Zaxo (Archbishop) on Jun 30, 2003 at 14:42 UTC

    Also, you have a colon where you want a semicolon in line 5:

    my $fail = MainWindow->new(); # ^

    After Compline,
    Zaxo

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://270159]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-16 11:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found