Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Re: \G assertion by fishbot_v2
in thread \G assertion by drock

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
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: (3)
As of 2024-04-24 04:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found