Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Mistakenly Believing split is using @_

by Maestro_007 (Hermit)
on Sep 19, 2001 at 22:15 UTC ( [id://113428]=note: print w/replies, xml ) Need Help??


in reply to Mistakenly Believing split is using @_

It's doesn't warn as a result of what you're splitting on, but what you're assigning to. In the olden days, the idiom would look like this:
split;
which would automatically assign the contents to @_. Maybe the warning should say Implicitly assigning result of split() to @_ is deprecated. I got burned on that one once upon a time, myself.

The reason the second snippet doesn't warn is that you have assigned the result to @chars. I think it's safe to say that the newer behavior is a Good Thing.

As to why the warning doesn't understand that you are still using the results in another context is a little puzzling, something that merlyn can probably answer.

MM

Update: void context =~ scalar context, got it. Thanks japhy!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found