Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Fill Gaps

by GrandFather (Saint)
on Nov 23, 2006 at 20:35 UTC ( [id://585779]=note: print w/replies, xml ) Need Help??


in reply to Fill Gaps

It's not clear what you want to achieve. Maybe the following Perl code will help? Just replace the text in the hash with whatever you want to fill the gaps with.

use strict; use warnings; my %fillers = ( A => "Whatever is required for the A gap here", B => "Whatever is required for the B gap here", C => "Whatever is required for the C gap here", ); while (<DATA>) { s/_*(\w)_+/$fillers{$1}/eg; print; } __DATA__ function start() { __A________________________________________________; } function validate( event ) { if ( B_____{ event.preventDefault(); C__________________; alert( "Wrong format for age!" ); } }

Prints:

function start() { Whatever is required for the A gap here; } function validate( event ) { if ( Whatever is required for the B gap here{ event.preventDefault(); Whatever is required for the C gap here; alert( "Wrong format for age!" ); } }

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: Fill Gaps
by ww (Archbishop) on Nov 25, 2006 at 13:55 UTC
    given Joost's observations (++) and the reply from GrandFather (++), I nearly have to upvote and keep the OP (--) ...
        ... just so it remains as an object lesson!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://585779]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-20 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found