Chas. Owens wrote:
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$/+

Or:

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



John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
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