Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-29 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found