On 2010.07.09 08:34, Robert Wohlfarth wrote:
> On Fri, Jul 9, 2010 at 5:16 AM, marcos rebelo <ole...@gmail.com> wrote:
> 
>> the fact of or not the prototype in the xpto function, I get this
>> warning: 'Use of implicit split to @_ is deprecated at script.pl line
>> 5.'
>>
>> use strict;
>> use warnings;
>>
>> sub xpto($) {};
>> xpto( split(/\n/, "fv\nfg" ) );
>>
> 
> I believe the code is calling "split" in a scalar context. Scalar context
> returns the number of elements - not the different elements. Making "xpto"
> take a list as its parameter stopped the warning message. So according to
> the warning message, "split" should not be called in a scalar context.

perldoc perldiag:

Use of implicit split to @_ is deprecated (D deprecated, W syntax) It
makes a lot of work for the compiler when you clobber a subroutine's
argument list, so it's better if you assign the results of a split()
explicitly to an array (or list).

Steve

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to