Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

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!" ); } }


    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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-06-21 21:47 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.