: Am rather a beginner at perl and was wondering how to do the following. I've
: read in a text file containing a list of file paths.  the list is read in to
: an array. I want to scan through the whole array and remove all lines with
: end as .txt and .scc. i.e remove that element in the array.  My file list
: looks like this:
: 
: D:\Liberate\Connect\app\pages\servicemanager\splash.gif
: D:\Liberate\Connect\app\pages\servicemanager\splash.html
: D:\Liberate\Connect\app\pages\servicemanager\vssver.scc
: D:\Liberate\Connect\app\pages\servicemanager\sounds\enter.wav
: D:\Liberate\Connect\app\pages\servicemanager\sounds\key.wav
: D:\Liberate\Connect\app\pages\servicemanager\sounds\vssver.scc

grep() will do it easily:

@lines = grep { ! /\.txt$|\.scc$/ } @lines;

or do it when you read the file:

@lines = grep { ! /\.txt$|\.scc$/ } <INFO>;

--
Tim Kimball · ACDSD / MAST        ¦ 
Space Telescope Science Institute ¦ We are here on Earth to do good to others.
3700 San Martin Drive             ¦ What the others are here for, I don't know.
Baltimore MD 21218 USA            ¦                           -- W.H. Auden

Reply via email to