Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Class::Struct problem

by choroba (Cardinal)
on Aug 28, 2022 at 19:31 UTC ( [id://11146478]=note: print w/replies, xml ) Need Help??


in reply to Class::Struct problem

You are populating the regex slot with a reference to an array. If you change the contents of the array and assign the reference to it to the second object's slot, the reference will stay the same. Either declare a new my array in the loop for each iteration, or use an anonymous array:
# Either: my @regexes = ...; $newp->regex(\@regexes); # Or: $newp->regex([@regexes]);

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

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

    No recent polls found