Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Last night I was dreaming about the project I'm working on. so what? standard stuff. The project is all perl. No big deal, this is a perl site ...

But here's the really worrying bit: I woke up because part of my brain said "That code will never work. You need to ..." and then the debugging process woke up within me and my full consciousness returned pondering map{} and regexes and then I couldn't go back to sleep.

You know you're in for trouble when you start wondering whether

for (my $i=1; $i<=10000; $i++) { my $s = Sheep->new($i); $gate->through($s); }
would be more efficient written using an array like this:
my @herd; for (1..10000) { push @herd(Sheep->new($_)); } $gate->through(\@herd);
and then worrying whether you'd do even better to one line the whole thing
$gate->through(Sheep->new($_)) for (1..10000);
and then you wonder whether you couldn't fork() cunningly so that part of you is running Sheep->new($_) while another part is doing the gate->through($previous_sheep) bit. And then you wake up screaming because you still haven't figured out how to get windows to fork properly...

And we try again

$me =~ s!wide awake!fast asleep!g;
no hang on maybe I need to use the /e modifier.
$me =~ s!wide awake!asleep(fast)!ge;
no no no that'll never work I need quotes
$me =~ s!wide awake!asleep('fast')!ge;
ANd maybe I'm not wide awake so how about
$me =~ s!(wide )?awake!asleep('fast')!ge;
or better
$me =~ s!(?:wide\s+)?awake!asleep('fast')!ge;


Enter any 47-digit prime number to continue.

In reply to Dreaming in Perl by dingus

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?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2023-09-28 18:06 GMT
Find Nodes?
    Voting Booth?

    No recent polls found