Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Unable to find my mistake

by GrandFather (Saint)
on Mar 17, 2021 at 23:07 UTC ( #11129855=note: print w/replies, xml ) Need Help??


in reply to Unable to find my mistake

use strict; use warnings; my $par_value = 3; my $inData = <<INDATA; wire [130 : 0] dgrs_1; wire [130 : 0] dgrs_2; wire [130 : 0] mgs_1; wire [130 : 0] mgs_2; wire [130 : 0] pqr_1; wire [130 : 0] pqr_2; int abc; int pqr_1; int pqr_2; .dgrs_1(dgrs_1); .dgrs_2(dgrs_2); .mgs_1(mgs_1); .mgs_2(mgs_2); INDATA open my $in_fh1, '<', \$inData; while (my $line = <$in_fh1>) { if ($line =~ m{ \A (.*dgrs) }xms) { print "${1}_$_;\n" for 1 .. $par_value; } if ($line =~ m{ \A ("\.dgrs") }xms) { print "${1}_$_;\n" for 1 .. $par_value; } if ($line =~ m{ \A (.*mgs) }xms) { print "${1}_$_;\n" for 1 .. $par_value; } if ($line =~ m{ \A (.*pqr) }xms) { print "${1}_$_;\n" for 1 .. $par_value; } elsif ($line !~ m/(?:dgrs|mgs|pqr)/) { print $line; } } close $in_fh1;

seems sufficient to reproduce your problem. Check your regular expressions are matching what you expect them to.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-08-19 13:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?