Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Re: Re: Scoping issues with code evaluation asserstions?

by diotalevi (Canon)
on Jun 19, 2003 at 19:08 UTC ( [id://267308]=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Scoping issues with code evaluation asserstions?
in thread Scoping issues with code evaluation asserstions?

You'd need to have declared $ret as a global somewhere for local to localize it. Remember that local() declares nothing.

use vars '$ret'; sub regex { local $ret = '';

What you didn't realize was that the (?{ ... }) is a closure so when it first ran it captured the original $ret and continued to write to that same instance which wasn't the same one being returned in later iterations.

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-06-19 10:26 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.