develooper Front page | perl.golf | Postings from August 2002

Re: Ircnet minigolf 4, maybe too easy

Thread Previous
From:
Stephen Turner
Date:
August 19, 2002 03:54
Subject:
Re: Ircnet minigolf 4, maybe too easy
Message ID:
Pine.LNX.3.96.1020819113723.1690A-100000@gentoo
On Mon, 19 Aug 2002, John W. Krahn wrote:

> Stephen Turner wrote:
> > 
> > 
> > Can anyone explain the following? Or is it just one of those Perl quirks
> > that one frequently encounters when playing golf :-) ?
> > 
> > % perl -e'@x=(st);print <@x>'
> > st
> > 
> > % perl -e'$x="st";print <$x>'
> > 
> > % perl -e'%x=(st=>1);print <%x>'
> > %x
> 
> 
> You mean the fact that $ and @ are interpolated while % isn't or that a
> scalar inside <> is a file handle while an array inside <> is a glob?
> 
> 

Ah yes, I get it now, thank you. <$x> is a filehandle -- but you can use
<${x}> to force it to be a glob. %x doesn't get interpolated inside double-
quoted strings anyway.

-- 
Stephen Turner, Cambridge, UK    http://homepage.ntlworld.com/adelie/stephen/
"This is Henman's 8th Wimbledon, and he's only lost 7 matches." BBC, 2/Jul/01



Thread Previous


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