Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: variable scope within eval{}

by holli (Abbot)
on Jan 29, 2010 at 22:48 UTC ( [id://820416]=note: print w/replies, xml ) Need Help??


in reply to variable scope within eval{}

insert_budget_line does probably not return what you think it does. Did you check?


holli

You can lead your users to water, but alas, you cannot drown them.

Replies are listed 'Best First'.
Re^2: variable scope within eval{}
by Stegalex (Chaplain) on Jan 29, 2010 at 23:12 UTC
    Yes I did and it works fine in the eval block but is invisible when passed to the sub

      Easy enough to prove it works:

      >perl -wMstrict -le "my $bl_id; my @bly_id; sub insert_budget_line { return 'foo'; } sub insert_budget_line_year { return @_[1,0]; } eval { $bl_id = insert_budget_line(); @bly_id = insert_budget_line_year(bl_id => $bl_id); }; print qq{@bly_id}; " foo bl_id

      How is your  insert_budget_line_year function defined?

      Can you post the relevant code of the sub you call?


      holli

      You can lead your users to water, but alas, you cannot drown them.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found