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

Re: Obsolete text in utf8.pm

Thread Previous | Thread Next
From:
John Imrie
Date:
December 26, 2015 10:40
Subject:
Re: Obsolete text in utf8.pm
Message ID:
567E6EA5.9040504@virginmedia.com
how about null sub names? I wonder why the attached file isn't a syntax
error.
>
> -----------------------------------------------------------------------
> C:\p523\src>perl t.pl
> Undefined subroutine &main::  called at t.pl 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About