Jalcock501 has asked for the wisdom of the Perl Monks concerning the following question:
Morning Brothers of the Monastery
I have an interesting question, well at least to me.
I have a script that holds the names of files(with a specific extension) in an array. However I would like to remove the extension from these files, but only in the array. Is there a way of amending all of the array elements to remove the extensions.In this case on 3 character (.fo as an example)
Thanks JimUPDATE: Here is the code I have so far:
#! /usr/bin/perl -w use strict; my @files = <*.fo> for(@files) { s/[.]fo//g; } print @files;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Array Manipulation
by Corion (Patriarch) on Oct 08, 2013 at 08:25 UTC | |
Re: Array Manipulation
by kcott (Archbishop) on Oct 08, 2013 at 08:32 UTC | |
by Jalcock501 (Sexton) on Oct 08, 2013 at 08:41 UTC | |
by kcott (Archbishop) on Oct 08, 2013 at 09:07 UTC | |
Re: Array Manipulation
by Jalcock501 (Sexton) on Oct 08, 2013 at 08:53 UTC | |
by Corion (Patriarch) on Oct 08, 2013 at 09:03 UTC | |
by Jalcock501 (Sexton) on Oct 08, 2013 at 09:06 UTC | |
by Anonymous Monk on Oct 08, 2013 at 09:06 UTC |
Back to
Seekers of Perl Wisdom