use strict;
use warnings;
use 5.010;
use Data::Dump qw(dump dd ddx);
sub p2 { 'P2' }
sub nop1 { }
sub nop2 { return }
sub test { say dump @_ }
test( 'P1', 'P2', 'P3' );
test( 'P1', p2, 'P3' );
test( 'P1', nop1, 'P3' );
test( 'P1', nop2, 'P3' );
__DATA__
Output:
("P1", "P2", "P3")
("P1", "P2", "P3")
("P1", "P3")
("P1", "P3")
####
use strict;
use warnings;
use 5.010;
my $pat = ':';
my $str = 'O:K';
my $pat_ref = \$pat;
my $str_ref = \$str;
my @par = ( $pat, $str );
my $rv = split $pat, $str; # OK
$rv = split $pat, $$str_ref; # OK
$rv = split $$pat_ref, $$str_ref; # OK
$rv = split( $par[0], $par[1] ); # OK
# W1: Use of uninitialized value $_ in split
$rv = split @par; # NOK W1
$rv = split(@par); # NOK W1
$rv = split( @par[ 0, 1 ] ); # NOK W1
$rv = split( ( @par[ 0, 1 ] ) ); # NOK W1
$rv = split( map { $_ } @par ); # NOK W1
$rv = split( ( map { $_ } @par ) ); # NOK W1
##
##
#!/usr/bin/perl -w
use strict;
use warnings;
use 5.010;
use Data::Dump qw(dump dd ddx);
ddx (1,'a', ());
ddx scalar (1,'a');
ddx scalar (1,'a', ());
my $var = (1,'a', ());
ddx $var;
__DATA__
output:
Useless use of a constant ("a") in void context at pm_empty_list.pl line 11.
Useless use of a constant ("a") in void context at pm_empty_list.pl line 12.
# pm_empty_list.pl:9: (1, "a")
# pm_empty_list.pl:10: "a"
# pm_empty_list.pl:11: undef
# pm_empty_list.pl:13: undef
##
##
# pm_empty_list.pl:11: undef
# pm_empty_list.pl:13: undef
##
##
# pm_empty_list.pl:11: "a"
# pm_empty_list.pl:13: "a"