in reply to Array Manipulation
G'day Jalcock501,
That's very little to go on. Here's one way to do it:
s/\.fo$// for @files;
Update (in response to your update): You're almost there with s/[.]fo//g. As you can see, is fairly close to what I posted (before you showed any code). Here's the differences:
- "\." and "[.]" are functionally equivalent: they both match a single '.'.
- You don't have a '$' anchoring the pattern to the end of the string: without it, the pattern matches ".fo" anywhere in the string.
- You have a 'g' modifier. This is for repeat matches. You only want to match once, in this instance.
For more details on any of those points, see "perlretut - Perl regular expressions tutorial" and/or "perlre - Perl regular expressions".
-- Ken
In Section
Seekers of Perl Wisdom