These scripts are the same forwards and backwards, excluding whitespace characters and newlines.
Making a JAPH palindrome was fairly easy using comments.
#!/usr/bin/perl #__ATAD__ print 'Just another Perl hacker,'#; #',rekcah lreP rehtona tsuJ' tnirp __DATA__# lrep/nib/rsu/!#
It took me a bit of thinking to make one without the crutch of comment lines.
#!/usr/bin/perl open fi, ">&STDOUT"; use constant X__ATAD__; print fi 'Just another Perl hacker,'; ',rekcah lreP rehtona tsuJ' if tnirp ;__DATA__ X tnatsnoc esu ;"TUODTS&>" ,if nepo lrep/nib/rsu/!#
Now, trying to create a JAPH palindrome without the use of comments or DATA? :shudder:
EDIT:Fixed based on blokhead's advice/corrections.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: JAPH palindrome.
by blokhead (Monsignor) on Sep 24, 2010 at 23:11 UTC | |
by jffry (Hermit) on Sep 25, 2010 at 01:40 UTC | |
Re: JAPH palindrome.
by JavaFan (Canon) on Sep 25, 2010 at 00:19 UTC | |
by jffry (Hermit) on Sep 25, 2010 at 01:53 UTC | |
by JavaFan (Canon) on Sep 25, 2010 at 10:17 UTC | |
Re: JAPH palindrome.
by JavaFan (Canon) on Sep 25, 2010 at 10:26 UTC | |
by xyzzy (Pilgrim) on May 24, 2011 at 18:22 UTC | |
Re: JAPH palindrome.
by JavaFan (Canon) on Sep 25, 2010 at 10:24 UTC | |
by jffry (Hermit) on Sep 25, 2010 at 16:55 UTC | |
Re: JAPH palindrome.
by jffry (Hermit) on Sep 25, 2010 at 16:44 UTC | |
by JavaFan (Canon) on Sep 25, 2010 at 16:57 UTC | |
by jffry (Hermit) on Sep 26, 2010 at 07:09 UTC |