Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by Rudif (Hermit)
on Dec 10, 2003 at 00:35 UTC ( #313616=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?

As davido points out, my question is : how to get rid of the warning.

And in as few keystrokes as possible, without a significant time overhead.

Finally, I decided to try the obvious solution : turn off warnings locally.

sub split_simple_quiet { no warnings; my $n = scalar split ',', $str; #print "$n\n"; }
This does the job and costs almost nothing in time, as the expanded benchmark shows:
Use of implicit split to @_ is deprecated at H:\dev\perl\perlmonks\ben +ch.pl line 23. Benchmark: timing 10000 iterations of split_anonymous, split_simple, s +plit_simple_quiet... split_anonymous: 24 wallclock secs (15.55 usr + 0.00 sys = 15.55 CPU) + @ 643.00/s (n=10000) split_simple: 20 wallclock secs (12.23 usr + 0.00 sys = 12.23 CPU) @ +817.80/s (n=10000) split_simple_quiet: 18 wallclock secs (12.15 usr + 0.01 sys = 12.16 C +PU) @ 822.57/s (n=10000) Rate split_anonymous split_simple split_si +mple_quiet split_anonymous 643/s -- -21% + -22% split_simple 818/s 27% -- + -1% split_simple_quiet 823/s 28% 1% + --
Rudif

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2023-01-27 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?