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

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 " networkIP/numberofbits\n" if $die; $debug = 2; } else { $debug = 15; }

results in

$ ./ Use of implicit split to @_ is deprecated at ./ line 19. <> Use of uninitialized value in split at ./ line 19. (,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 (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 (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!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://802744]
Approved by SuicideJunkie
Front-paged by SuicideJunkie
[jedikaiti]: Hello, Monks

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2018-06-18 15:38 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (110 votes). Check out past polls.