use strict; use warnings; use File::Spec::Functions "devnull"; sub bar { open my $fh, "< $_[0]" or die "couldn't open $_[0]: $!"; print while <$fh>; } sub foo { for (@_) { bar(devnull()) } } $. = 0; foo($.); #### use strict; use warnings; use Data::Dumper; $Data::Dumper::Terse=1; sub foo { print "foo: bad args: ", Dumper \@_ if @_ != 2 || $_[0] !~ /^[tf]/ || $_[1] !~ /statement/; my ($tf, $statement) = @_; if ($tf =~ /^t/) { # Line 12 print "true: $statement\n"; } else { print "false: $statement\n" } } for my $statement ("the following statement is true", "the preceding statement is false") { $statement =~ /\b(t|f|true|false)\b/ or next; foo($1, $statement); } #### foo(0+$.); # and foo("$1", $statement);