This code triggers the complaint below:
#!/usr/bin/perl
use strict;
use warnings;
my $s = \"aaa bbb\";
my $num_of_item = split(/\\s+/, $s) ;
print $num_of_
From the split docs:
In scalar context, returns the number of fields found. In scalar and void context it splits into the @_ array. Use of split in scalar and void context is deprecated, however, because it clobbers your subroutine arguments.
So, since you're using it in scalar context, it splits into the @_ array, which is a deprecated usage. (It has to do the split though, since it'd break old code expecting it to split into @_ - no way around the warning without assigning into a temporary array, as far as I know. Eugene Y has this explicitly in his answer.)