Chas. Owens wrote:
On Wed, Dec 31, 2008 at 21:40, Steven Rodriguez <optionshi...@gmail.com> wrote:
Well, as a beginner with per I have been fascinated with the "Just another
perl hacker" program or signature. So, I decided to make my own. Granted, I
am just a beginner so my version is fairly simple. All I did was make each
letter of the phrase and independent variable. Still, it is fun to see
people's reaction when I use it on my email signature.
Here it is:
#!/usr/bin/perl
$J ="J" ;
$U ="u" ;
$S ="s" ;
$T ="t" ;
$A ="a" ;
$N ="n" ;
$O ="o" ;
$T ="t" ;
$H ="h" ;
$E ="e" ;
$R ="r" ;
$P ="P" ;
$E ="e" ;
$R ="r" ;
$L ="l" ;
$H ="h" ;
$A ="a" ;
$C ="c" ;
$K ="k" ;
$E ="e" ;
$R ="r" ;
$, ="," ;
print "$J$U$S$T $A$N$O$T$H$E$R $P$E$R$L $H$A$C$K$E$R $,\n" ;
Nifty. One of the goals of a JAPH is to demonstrate one or more of
Perl's advantages/quirks. Yours shows variable interpolation and the
fact that $, can be a variable. Here is one based on yours that
(ab)uses the quote-like operators*, uc** (using the default variable),
string eval***, the list separator****, and the input record
separator*****.
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
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/