Hello monks,
I'm trying to extract the text between the slashes just before the end of the text foo.
C:/WINDOWS/TEST/Vendor/Bomb_USR/foo C:/WINDOWS/TEST/Vendor/Bomb_MOT/foo C:/WINDOWS/TEST/Vendor/Bay_Accelar/foo C:/WINDOWS/TEST/Vendor/BayStackHub/foo C:/WINDOWS/TEST/Vendor/Ascend_4000/foo C:/WINDOWS/TEST/Vendor/Aironet/foo C:/WINDOWS/TEST/Vendor/ADC_Cuda/foo C:/WINDOWS/TEST/Vendor/3ComTokenRing/foo
So I'm using this code to try and extract the following list:
Bomb_USR Bomb_MOT Bay_Accelar BayStackHub Ascend_4000 Aironet ADC_Cuda 3ComTokenRing foreach (@FILES) { if m[\/\w+foo\$] { $_ =~ s/foo//; push @array, $_; } } print "$_\n" for @array;
What am I doing wrong?

In reply to regex needed with match operator by Anonymous Monk

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.