On Thu, Jan 1, 2009 at 01:54, John W. Krahn <jwkr...@shaw.ca> wrote:
snip
>> eval q.$..(uc).qq.='$_'.for split//, "JustanotherPerlhacker";
>> print qq'$J$U$S$T$"$A$N$O$T$H$E$R$"$P$E$R$L$"$H$A$C$K$E$R$/';
>
> If you don't have warnings and strict enabled you could just do this:
>
> $ perl -e'
> ${uc;}=$_ for split//, "JustanotherPerlhacker";
> print qq[$J$U$S$T$"$A$N$O$T$H$E$R$"$P$E$R$L$"$H$A$C$K$E$R$/]
> '
> Just another Perl hacker
snip

But then it doesn't line up with the second line.  Of course, we can
always pad it out by taking advantage of the effects of a list in
scalar context:

${(1,2,3,4,5,+uc)}=$_ for split //, "JustanotherPerlhacker";
print qq'$J$U$S$T$"$A$N$O$T$H$E$R$"$P$E$R$L$"$H$A$C$K$E$R$/'

or even take advantage of barewords:

${(uppercase,+uc)}=$_ for split //, "JustanotherPerlhacker";
print qq'$J$U$S$T$"$A$N$O$T$H$E$R$"$P$E$R$L$"$H$A$C$K$E$R$/'

We could also go + happy:

+${+uc}=+$_ for+split+//,+"JustanotherPerlhacker";print
+qq+$J$U$S$T$"$A$N$O$T$H$E$R$"$P$E$R$L$"$H$A$C$K$E$R$/+

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to