Since you, Robin Hood, provided no sample data nor indication of your required output, this is a WAG... but it may provide a workaround... or some ideas for one.

#!/usr/bin/perl use Modern::Perl; use Data::Dumper; #945627 Workaround if the distinction among elements in each data # segment need not be retained; if retention # is required, read DATA into a HoA with the # separator-and-its-following-digit(s) as keys. say "\n\t \$/ is a string, not a regex," . "\n\t so, using an input_separator without any regex metachar \n"; $/ = "FOO"; my @newarr; my @arr = <DATA>; for my $item(@arr) { $item =~ s/\n//sg; if ( $item =~ /^\d+(.+?)(?:FOO)*$/s ) { my $out = $1; push @newarr, $out; } else { say "\t Disgarding $item (ie, \$arr[1])"; # discarding the in +itial "FOO" in $arr[1] } } print Dumper @newarr; =head OUTPUT $/ is a string, not a regex, so, using an input_separator without any regex metachar Disgarding FOO (ie, $arr[1]) $VAR1 = 'abcdefghi'; $VAR2 = 'jkl-123-'; $VAR3 = 'mnopqrstu'; $VAR4 = 'vwxyz'; =cut __DATA__ FOO0 abc def ghi FOO1 jkl -123- FOO2 mno pqr stu FOO3 vwxy z
Of course, it's also possible that this has no bearing on your problem... :-(

In reply to Re: Usage of regular expressions in input separator by ww
in thread Usage of regular expressions in input separator by archer

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.