Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^2: variable scope within eval{}

by Stegalex (Chaplain)
on Jan 29, 2010 at 23:12 UTC ( #820421=note: print w/replies, xml ) Need Help??

in reply to Re: variable scope within eval{}
in thread variable scope within eval{}

Yes I did and it works fine in the eval block but is invisible when passed to the sub

Replies are listed 'Best First'.
Re^3: variable scope within eval{}
by AnomalousMonk (Chancellor) on Jan 29, 2010 at 23:18 UTC

    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?

Re^3: variable scope within eval{}
by holli (Monsignor) on Jan 29, 2010 at 23:19 UTC
    Can you post the relevant code of the sub you call?


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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://820421]
[LanX]: every path must have l left and r right edges and l and r are fixed and l+r is the height
[LanX]: simple recursive function which goes left and right till l or r are exhausted
LanX #solved
[oiskuu]: I must watch Police Academy again sometime.
[Discipulus]: thanks all
[LanX]: ?

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-03-19 11:26 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (239 votes). Check out past polls.