Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Regex and writing lines in file

by BillKSmith (Vicar)
on Apr 30, 2013 at 14:59 UTC ( #1031420=note: print w/replies, xml ) Need Help??

in reply to Regex and writing lines in file

Do we have to test for matches in the three lines after the first match?

Replies are listed 'Best First'.
Re^2: Regex and writing lines in file
by amma (Novice) on May 01, 2013 at 10:02 UTC

    Yes there is one line where we can do match out of the three lines and that line is the first line in three lines.

      The following code uses an array as a "circular list" to delay the printing of the EXTRA. Is this what you need?
      use strict; use warnings; my $match = qr /Match/; my $extra = qq(EXTRA\nEXTRA\n); my @extras = (q()) x 3; my $in = 3; my $out = 0; while (my $line = <DATA>) { $out = ($out+1) % 4; print $line, $extras[$out]; $in = ($in +1) % 4; $extras[$in] = ($line =~ /$match/)? $extra : q(); } __DATA__ a b Match1 Match2 c d e f g Match3 h i j k

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031420]
[Discipulus]: I already know how much distinct paths exists but to demonstrate the property i want to have them all
[oiskuu]: ie C(n, k); where n is height difference, k is position in the line
[Discipulus]: infact there are 70 distinct path to reach the tale wich holds 70
[Discipulus]: what i want is to compute them
[oiskuu]: You want to draw the path? $iter = combinations( $TOP_HEIGHT .. $NODE_HEIGHT, $pos); then get the path from the iter, level change at depth x, for(..) $pos += $level_change; something like that

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2018-03-19 11:05 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (239 votes). Check out past polls.