Monks,
Lately I've been writing a number of scripts that deal with lists of partial filenames. Most of these are one-offs, so it's natural to write them in the same file as my data and use the DATA filehandle:
#! /usr/bin/perl -w while(<DATA>) { my $path = `find /partial/prefix/path -name "*$_*"`; ... } __END__ filepart1 filepart2 ... filepartN
This is a misguided path. The data after __END__ needs processing ("chewing"):
while(<DATA>) { chomp; ... }
I find this error depressingly easy to make. Save yourself some time, effort, and angst: don't forget to chomp your DATA before you process it.
--
The hell with paco, vote for Erudil!
:wq
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Chew before you swallow
by vladb (Vicar) on Jun 28, 2002 at 03:31 UTC | |
|
Re: Chew before you swallow
by Sweeper (Pilgrim) on Jun 28, 2002 at 05:39 UTC | |
|
Re: Chew before you swallow
by stajich (Chaplain) on Jun 28, 2002 at 14:12 UTC | |
|
Re: Chew before you swallow
by tadman (Prior) on Jun 28, 2002 at 22:19 UTC | |
|
Re: Chew before you swallow
by BUU (Prior) on Jun 28, 2002 at 05:02 UTC | |
by tadman (Prior) on Jun 28, 2002 at 22:17 UTC |