Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

(update: the first one has been edited to fix problems/bad style since I first pressed submit. Oopsie.)

use strict; my @result; my $one = "a" =~ /./; sub add { my($vA,$vB) = @_; ($vA,$vB) = ($vA^$vB,($vA&$vB)<<$one) while $vB; return $vA; } my $val = $one; do { push @result, $val; $val = add($val,$one); } until $one.$one eq $val;

... or, without any lines preceeding it in the file it's in ...

sub f { die if $::f_A; die if $::f_B; die if $::f_C; die if $::f_D; die if $::f_E; die if $::f_F; die if $::f_G; die if $::f_H; die if $::f_I; die if $::f_J; } my @vars = map { "::f_$_" } qw(A B C D E F G H I J); my @result; foreach (@vars) { $$_ = "true"; eval { f() }; push @result, $@ =~ /line ([^.]+)\./; $$_ = undef; }

update: A very, very cheap solution: (doesn't work on EBCDIC systems, sorry)

my @result = split " ", "pasarauatawavayaxapq"^"AAAAAAAAAAAAAAAAAAAA";


In reply to Re: TMTOWTDI Puzzle: Generating a range of numbers by wog
in thread TMTOWTDI Puzzle: Generating a range of numbers by Masem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-25 21:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found