in reply to Re^2: $. - smarter than you might think
in thread $. - smarter than you might think
don't talk nonsense at blah.pl line 23. 21 learn('nothing'); 22 sub blah (\[&]) { 23 warn "don't talk nonsense"; > 24 $_[0]->(); 25 } 26 sub learn { 27 my $self->teach(shift); Can't use string ("bar") as a subroutine ref while "strict refs" in us +e at blah.pl line 24.
I discovered this playing with your code, btw. Thanks!
cheers,
--shmem
hmm.. why does it succeed to compile and run whilst calling blah() with a scalar and not a subref?#!/usr/bin/perl use strict; $SIG{__DIE__} = sub { if(my ($d) = $_[0] =~ /line (\d+)/) { seek DATA,0,0; while(<DATA>) { if($. == $d) { warn '> '.$..' '.$_; } else { warn ' '.$..' '.$_ if ($. > $d - 4) && ($. < $d + 4); } } } }; my $foo = 'bar'; blah($foo); learn('nothing'); sub blah (\[&]) { warn "don't talk nonsense"; $_[0]->(); } sub learn { my $self->teach(shift); warn "got it"; } __END__
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: $. - smarter than you might think
by radiantmatrix (Parson) on Jun 26, 2006 at 15:56 UTC | |
by shmem (Chancellor) on Jun 26, 2006 at 16:23 UTC |