Click here to get back home

every combination of Y/N in 5 positions

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
every combination of Y/N in 5 positions joemacbusiness 03-31-2008
Posted by Abigail on April 2, 2008, 8:52 am
Please log in for more thread options
_
Frank Seitz (devnull4711@web.de) wrote on VCCCXXVIII September MCMXCIII
:: Abigail wrote:
:: >
:: > It's a silly attempt to obfuscate the code.
:: >
:: > It's much better written as:
:: >
:: > foreach (0 .. 0b11111) {
:: > my $_ = sprintf '%05b' => $_;
:: > tr _01_NY_;
:: > say "$::_:$_";
:: > }
::
:: Nice.
::
:: > No silly typeglobs needed.
::
:: You forgot
::
:: use 5.10.0;


And I "forgot" #!/usr/bin/perl, I "forgot" "vi whatever",
I "forgot" "perl whatever", etc, etc.


I just focus on the important bit, and don't like to clutter the messages
with details.


Abigail
--
perl -Mstrict -we '$_ = "goto C.print chop;\n=rekcaH lreP rehtona tsuJ";C1:eval'

Posted by Frank Seitz on April 2, 2008, 9:08 am
Please log in for more thread options
Abigail wrote:
> Frank Seitz (devnull4711@web.de) wrote on VCCCXXVIII September MCMXCIII
> :: You forgot
> ::
> :: use 5.10.0;
>
> And I "forgot" #!/usr/bin/perl, I "forgot" "vi whatever",
> I "forgot" "perl whatever", etc, etc.
>
> I just focus on the important bit, and don't like to clutter the messages
> with details.

Okay, but without this statement your program doesn't run -
even under Perl 5.10. So it *is* important.

Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Posted by Peter J. Holzer on April 3, 2008, 7:27 pm
Please log in for more thread options
> Abigail wrote:
>> Frank Seitz (devnull4711@web.de) wrote on VCCCXXVIII September MCMXCIII
>> :: You forgot
>> ::
>> :: use 5.10.0;
>>
>> And I "forgot" #!/usr/bin/perl, I "forgot" "vi whatever",
>> I "forgot" "perl whatever", etc, etc.
>>
>> I just focus on the important bit, and don't like to clutter the messages
>> with details.
>
> Okay, but without this statement your program doesn't run -
> even under Perl 5.10. So it *is* important.

A code fragment doesn't necessarily run. That's no problem. However, I
think most perl programmers are currently still using 5.8.x, and may not
know exactly which features are new in 5.10 - so just posting
5.10-specific code without mentioning that it is 5.10-specific is less
then ideal (I admit that the use of "say" probably served as a heads-up
in this case).

        hp

Posted by Gunnar Hjalmarsson on April 2, 2008, 4:06 pm
Please log in for more thread options
Abigail wrote:
> David Harmon (source@netcom.com) wrote on VCCCXXVIII September MCMXCIII
> [] On Mon, 31 Mar 2008 23:23:25 +0200 in comp.lang.perl.misc, Gunnar
> [] >I do, I hope. :)
> [] >
> [] > foreach my $num ( 0 .. 0b11111 ) {
> [] > local *_ = \ sprintf '%05b', $num;
> []
> [] What is *_ ? It looks like one of those magic perl variables, but
> [] I don't find any documentation on it.
>
> It's a silly attempt to obfuscate the code.

I didn't do it for the sake of it; please see the sub-thread starting
with
http://groups.google.com/group/comp.lang.perl.misc/browse_frm/thread/1c6904d6a4774258/e56a5cb3831212df
and the advice provided there by Ben and Brian.

See also Ben's reply in this thread.
http://groups.google.com/group/comp.lang.perl.misc/msg/3c4e0ee726c4cded

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Posted by Abigail on April 2, 2008, 7:07 pm
Please log in for more thread options
_
Gunnar Hjalmarsson (noreply@gunnar.cc) wrote on VCCCXXVIII September
^^ Abigail wrote:
^^ > David Harmon (source@netcom.com) wrote on VCCCXXVIII September MCMXCIII
^^ > [] On Mon, 31 Mar 2008 23:23:25 +0200 in comp.lang.perl.misc, Gunnar
^^ > [] >I do, I hope. :)
^^ > [] >
^^ > [] > foreach my $num ( 0 .. 0b11111 ) {
^^ > [] > local *_ = \ sprintf '%05b', $num;
^^ > []
^^ > [] What is *_ ? It looks like one of those magic perl variables, but
^^ > [] I don't find any documentation on it.
^^ >
^^ > It's a silly attempt to obfuscate the code.
^^
^^ I didn't do it for the sake of it; please see the sub-thread starting
^^ with
^^
http://groups.google.com/group/comp.lang.perl.misc/browse_frm/thread/1c6904d6a4774258/e56a5cb3831212df
^^ and the advice provided there by Ben and Brian.


I read it. I still think it's obfuscated. Why use a package scoped glob
if you can use a lexical variable (even $_)?




Abigail
--
A perl rose: perl -e '@}>-`-,-`-%-'

Similar ThreadsPosted
Looking for combination.pm June 29, 2005, 10:56 pm
Perl + Objects = Winning combination April 9, 2007, 7:55 pm
Perl Developer Positions in California March 11, 2005, 12:53 pm
htaccess rewriterule in combination with POST form January 28, 2005, 12:38 am
How can I add tokens at arbitrary positions on a line in a file? August 13, 2005, 6:36 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap