Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Re: How to get the number of fields found by split without a warning?

by davido (Cardinal)
on Dec 09, 2003 at 06:40 UTC ( [id://313373]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: How to get the number of fields found by split without a warning?
in thread How to get the number of fields found by split without a warning?

I like Roger's  my $qty = scalar ( split ',', $string ); method, however, it takes us back to where we started, by generating a warning message about implicit splitting into @_ being deprecated (if the code is tested under -w or use warnings;).

Unfortunately, the solution is either to turn off warnings for that section of code, or to revert back to the other solution which makes an extra copy:  my $qty = @{[ split ',', $string ]};.

Of course, if all you're trying to do it count commas except for trailing ones, you could probably just loop through the string instead.


Dave

Log In?
Username:
Password:

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

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

      No recent polls found