Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: split function

by davido (Archbishop)
on Jan 25, 2012 at 03:19 UTC ( #949814=note: print w/replies, xml ) Need Help??

in reply to split function

Does Perl 5.8.8 allow you to explicitly assign values to numbered variables such as $1? Because with Perl 5.14.2, with this snippet:

perl -E '$1 = 100; say $1;'

I get this message:

Modification of a read-only value attempted at...

Perl imposes no artificial limits on how many elements a string may be split into with the split function, nor does Perl care how many variables you assign to. So I think for us to determine what is going wrong you would need to show us a small snippet of the actual code that is failing.

Though Perl imposes no limits on how many variables you can assign to, common sense and good style may dictate that assigning to thirty six variables that are numbered might be a construct better handled with an array.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://949814]
[Lady_Aleena]: [pad://]
[james28909]: my scratchpad
[james28909]: and like i say, is just an example, not working code, but hopefully you understand what i mean. :)
[james28909]: and like i say, it would be alot of work to get around renaming 3 subs haha
[Lady_Aleena]: Well, you would have to add the file munging and a lot more.
[james28909]: yeah but it would rename those subs xD
[Lady_Aleena]: I'd say, go back to my scratchpad, and really look at what the 3 subs are doing, then play. Meanwhile, I am going afk for about an hour +/- a few minutes.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2017-05-24 05:22 GMT
Find Nodes?
    Voting Booth?