Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Fill Gaps

by zhshqzyc (Initiate)
on Nov 23, 2006 at 18:27 UTC ( [id://585760]=offtopicroot: print w/replies, xml ) Need Help??

This posting has been designated as off topic for the PerlMonks web site.


This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Fill Gaps
by Joost (Canon) on Nov 23, 2006 at 20:17 UTC
Re: Fill Gaps
by GrandFather (Saint) on Nov 23, 2006 at 20:35 UTC

    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
      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?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 06:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found