Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Unexpected "Use of implicit split to @_ is deprecated"

by kp2a (Sexton)
on Oct 22, 2009 at 13:39 UTC ( #802744=perlquestion: print w/ replies, xml ) Need Help??
kp2a has asked for the wisdom of the Perl Monks concerning the following question:

problem solved - needed an extra pair of eyes to see simply mistake - thanks!
#! /usr/bin/perl -w use strict; my $debug; my $test = $ARGV[0]; print "<$test>\n"; if($test) { my $die = 1; my @a; if($test =~ s!/!\t!) { split @a = split m/\t/,$test; print "($a[0],$a[1])\n"; $die = 0 if isip($a[0]) && ($a[1] <= 32 and $a[1] > 16); } die "updatenodes.pl networkIP/numberofbits\n" if $die; $debug = 2; } else { $debug = 15; }

results in

$ ./updatenodes.pl 10.100.20.52/24 Use of implicit split to @_ is deprecated at ./updatenodes.pl line 19. <10.100.20.52/24> Use of uninitialized value in split at ./updatenodes.pl line 19. (10.100.20.52,24)

unexpected split to @_ and unexpected uninitialized warnings - script produces correct results - I am splitting to a list (array) - earlier I had my ($ip,$mask) as my list with same results - the Friendly Manual says "In scalar context, returns the number of fields found and splits into the @_ array." - my use is in list context NOT scalar - how to get rid of unexpected warnings?

print statements were added to debug

Comment on Unexpected "Use of implicit split to @_ is deprecated"
Select or Download Code
Re: Unexpected "Use of implicit split to @_ is deprecated"
by BrowserUk (Pope) on Oct 22, 2009 at 13:46 UTC

    What do you think this line does?

    split @a = split m/\t/,$test;

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Unexpected "Use of implicit split to @_ is deprecated"
by SuicideJunkie (Priest) on Oct 22, 2009 at 13:48 UTC

    I only count 18 lines in your posted code; what is line 19?

    What did you intend split @a = split m/\t/,$test; to mean?
    You've got two splits in that line, and I expect the first split is what is causing you grief.

      right! typo! sorry!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://802744]
Approved by SuicideJunkie
Front-paged by SuicideJunkie
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2015-07-05 10:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls