Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

chargrill's scratchpad

by chargrill (Parson)
on Jan 13, 2006 at 23:50 UTC ( #523114=scratchpad: print w/replies, xml ) Need Help??

For hacker:

#!/usr/bin/perl use strict; use warnings; my $words = "this is a series of words"; $words =~ s{((\w+(?:'\w+)*))}{ my $res; ( $res = &link( $1 ) ) ? $res +: $1 }ge; print "$words\n"; sub link { my $word = shift; if( $word eq 'series' ){ return ucfirst $word; } return; }
this is a Series of words

I get complaints about "not enough arguments to link at line 9" if i omit the ampersand in front of the sub call.

Update, two return vals:

#!/usr/bin/perl use strict; use warnings; my $words = "this is a series of words"; $words =~ s{((\w+(?:'\w+)*))}{ my( $res, $y ); ( ( $res, $y ) = &link( + $1 ) ) ? "$res $y" : $1 }ge; print "$words\n"; sub link { my $word = shift; if( $word eq 'series' ){ return( ( ucfirst $word ), $word ); } return; }
this is a Series series of words

Chocolate Martini:

  • 1 part Bailey's Irish Cream
  • 1 part Absolut Vanilla Vodka
  • 1 part Godiva Chocolate Liquer
  • Healthy splash* of half and half

Drizzle Hershey's chocolate syrup around the martini glass. Shake 4 parts in ice, strain into glass. Garnish with a chocolate truffle.

*: Yes, it's a bit of an oxymoron. It just means more than a splash, but less than a part.

XP/Writeup Javascript: *

In case you're wondering how that got there, simply add </td></tr><tr><td>Avg. XP/Writeup:</td><td></td></tr> to your Location, and the following javascript somewhere in your bio.

<script language="javascript" type="text/javascript"> //<!-- var docBody = document.body.getElementsByTagName('center').item(0).get +ElementsByTagName('table').item(0).getElementsByTagName('tbody').item +(0).getElementsByTagName('tr'); var numExp = docBody.item(4).getElementsByTagName('td').item(1).getEle +mentsByTagName('b').item(0).innerHTML.valueOf(); var numPosts = docBody.item(6).getElementsByTagName('td').item(1).getE +lementsByTagName('b').item(0).getElementsByTagName('a').item(0).inner +HTML.valueOf(); var numExpPerPost = Math.round((numExp / numPosts)*100)/100; document.write( "Approximate number of XP gained per post is " + numEx +pPerPost + "<br><br>\n"); docBody.item(8).getElementsByTagName('td').item(1).innerHTML = '<b>[id +://523114|' + numExpPerPost + ']</b>'; //--> </script>

* By the way, this isn't entirely accurate - you gain XP by means other than getting posts ++'d. Voting on other posts, for example. So this metric is basically for kicks & grins. :-)

WWW::Mech::Shell failing tests:

t/14-command-identity.................NOK 142/302 # Failed test 'Shell moved to the specified url for get_redirect' # in t/14-command-identity.t at line 217. # 'http://kent-cowgills-computer.local:64770/redirec +t/startpage' # doesn't match '(?-xism:(?-xism:^http://kent-cowgills-computer.lo +cal:64770/startpage))' # get http://kent-cowgills-computer.local:64770/redirect/startpage # eval $self->agent->uri t/14-command-identity.................ok 231/302 + t/14-command-identity.................NOK 242/302 # Failed test '2 requests were made for reload' # in t/14-command-identity.t at line 220. # got: '1' # expected: '2' t/14-command-identity.................NOK 249/302 # Failed test '3 requests were made for reload_2' # in t/14-command-identity.t at line 220. # got: '2' # expected: '3' t/14-command-identity.................ok 301/302 # Looks like you failed 3 tests of 302. t/14-command-identity.................dubious + Test returned status 3 (wstat 768, 0x300) DIED. FAILED tests 142, 242, 249 Failed 3/302 tests, 99.01% okay t/26-form-no-form.....................ok 1/4 # Looks like you planned 4 tests but only ran 1. # Looks like your test died just after 1. t/26-form-no-form.....................dubious + Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 2-4 Failed 3/4 tests, 25.00% okay
Log In?

What's my password?
Create A New User
[mz2255]: Yes, just edited the scratchpad. Not sure if I'm doing something wrong, it's my first time.
[ambrus]: No, you're not doing anything wrong. It's just that our automatic spam filters confuse you with the spammers who post advertisments for online shops of counterfeit branded clothing.
[ambrus]: Or unless you left the title field empty or entered a very short title for the node, but then you'd get a message saying that.
[ambrus]: I hope Corion or some other admin is here and can check the logs to see what the problem is.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2017-10-19 15:32 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (255 votes). Check out past polls.