develooper Front page | perl.fwp | Postings from March 2008

Re: YN golf

Thread Previous | Thread Next
From:
Chris Dolan
Date:
March 31, 2008 21:37
Subject:
Re: YN golf
Message ID:
206CFBF6-AF74-46CD-9D30-145702C5675A@chrisdolan.net
On Mar 31, 2008, at 6:54 PM, Philippe Bruhat (BooK) wrote:
> On Mon, Mar 31, 2008 at 04:34:58PM -0700, Rick Klement wrote:
>>
>> perl -le 'print for glob"{Y,N}"x5'
>>
>
> Of course you have to run this in a directory that doesn't contain
> any file matching /^[YN]{5}$/.

Not true.  The {} notation doesn't care whether files of that name  
actual exist.  I tested like so on Mac:

% touch YYYYY
% perl -le 'print for glob"{Y,N}"x5'
YYYYY
YYYYN
YYYNY
YYYNN
YYNYY
YYNYN
YYNNY
YYNNN
YNYYY
YNYYN
YNYNY
YNYNN
YNNYY
YNNYN
YNNNY
YNNNN
NYYYY
NYYYN
NYYNY
NYYNN
NYNYY
NYNYN
NYNNY
NYNNN
NNYYY
NNYYN
NNYNY
NNYNN
NNNYY
NNNYN
NNNNY
NNNNN


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