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.
-
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.
|