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

"2nd param of split in a string.." compilation warning

by palkia (Monk)
on Mar 14, 2012 at 03:32 UTC ( [id://959498]=perlquestion: print w/replies, xml ) Need Help??

palkia has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone

I've just used split (with use: strict,warnings,diagnostics),
and from some reason during compilation (even before the terminal appeared) I got this warning:
"Line 1: The second parameter of split is a string,not an array
Do you want to continue?" (yes/no buttons)

Googling this didn't help much, I got that this may have something to do with the "use warnings" (which I wrote with an "s" in the end !),
or possibly something to do with the fact I'm using Padre.
But nothing helpful, not even any question/answer page.

By answering "yes" the code seems to run perfectly fine (including the split),
So just to mess around and see what will happen, I tried to substitute the string with an array, and got the same warning.
Also got the same warning when I tried to change the split pattern to another, and when I changed the split pattern from regex to plain string, and when the split was set into a string instead of array, its always the same weird warning !

My only non-neutralized split ($flnx is very much defined btw):
my @linx = split(/,/,$flnx);
Your thoughts ?
Thx

Update: Problem Resolved
Apparently is was a neutralized split one !
It was yesterday so I can't really find it now ^^ but it was something like this:
#my $something = split(/\.\n\d+: /,join(',',@somearray));
Yes with a # in the beginning ! soooo weird.

Regardless, thx 4 all the help attempts, appreciate it ^^

Replies are listed 'Best First'.
Re: "2nd param of split in a string.." compilation warning
by Anonymous Monk on Mar 14, 2012 at 04:37 UTC

    The second parameter of split is a string,not an array

    Perl doesn't produce this message

    $ perl -Mstrict -Mwarnings -le " print for split /,/, @ARGV " ro sham +bo 3

    or possibly something to do with the fact I'm using Padre.

    Probably this. ddging reveals this is Padre "beginner" mode and other Policies

Re: "2nd param of split in a string.." compilation warning
by davido (Cardinal) on Mar 14, 2012 at 04:04 UTC

    "Line 1: The second parameter of split is a string,not an array" is not a Perl warning as far as I know. And even using an array as the second parameter of 'split' will not generate a warning. Let's say you have an array that holds ten elements. As the second parameter in split the array will be evaluated in scalar context, returning the string "10". You'll be splitting "10" on whatever pattern you passed as the first param to split.


    Dave

Re: "2nd param of split in a string.." compilation warning
by Marshall (Canon) on Mar 14, 2012 at 04:14 UTC
    Can you show us a very abbreviated version of the code that reproduces this message?
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-19 07:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found