develooper Front page | perl.perl5.porters | Postings from December 2015

Re: Obsolete text in

Thread Previous | Thread Next
John Imrie
December 26, 2015 10:40
Re: Obsolete text in
Message ID:
how about null sub names? I wonder why the attached file isn't a syntax
> -----------------------------------------------------------------------
> C:\p523\src>perl
> Undefined subroutine &main::  called at line 2.
> C:\p523\src>
> -----------------------------------------------------------------------
You are not defining a null sub in the first line. You are creating a
sub ref and then throwing it away before
trying to call the undefined subroutine.

You would need to do
*{' '} = sub {print 'hello world';};
&{' '}();

Which works fine on my version of Perl

I also did
*{''} = sub {print 'hello world';};

which also worked fine.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About