Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: \G assertion

by fishbot_v2 (Chaplain)
on Aug 02, 2005 at 18:25 UTC ( [id://480275]=note: print w/replies, xml ) Need Help??


in reply to \G assertion

I need to print from one string to another using .. with \G My goal is to capture from allsets down.

Capture into what? A string? An array? If you just want to capture everything from /allsets/ .. /fs_clinical\.1/ into a scalar string then you can just do something like:

my $captured = ""; while ( <ARC> ) { $captured .= $_ if ( /allsets/ .. /fs_clinical\.1/ ); }

...but you seem to be trying to do something more. I don't know what you are trying to do with the / \G 'heartlab.1'/, but that isn't doing anything at all currently. \G generally doesn't make any sense unless it is used with /g and in some sort of a looped match. You don't have a looped match here, since you are changing the match-subject on each iteration.

Additionally, $1 is populated by (successful) capturing matches. You don't have any of those, so $1 is empty, if you are lucky. Mind you, you are assigning to a variable in a uselessly small scope, so it doesn't matter anyway.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-20 02:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found