http://www.perlmonks.org?node_id=802744

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

Replies are listed 'Best First'.
Re: Unexpected "Use of implicit split to @_ is deprecated"
by BrowserUk (Patriarch) 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 (Vicar) 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!