jbwiv has asked for the wisdom of the Perl Monks concerning the following question:
I have a file in which I store a list of file names. Often files will have $ symbols and other characters in the name:
com/eteks/awt/PJAGraphics$1.classI have a perl script that needs to read these file names and perform some different operations on them. I read it in as:
open(FH, "$datfile") || die "Can't open $datfile!"; while(my $line=<FH>) { chomp($line); push(@list, $line); }
Is there a way to escape all special characters in an input stream so that they remain characters rather than being interpreted as scalars by the interpreter?
Thanks in advance,
jbwiv
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading special characters from file?
by suaveant (Parson) on Apr 26, 2001 at 16:39 UTC | |
|
Re: Reading special characters from file?
by frankus (Priest) on Apr 26, 2001 at 16:39 UTC | |
by jbwiv (Acolyte) on Apr 26, 2001 at 17:36 UTC | |
by premchai21 (Curate) on Apr 26, 2001 at 19:13 UTC | |
|
Re: Reading special characters from file?
by mrmick (Curate) on Apr 26, 2001 at 16:44 UTC | |
|
Re: Reading special characters from file?
by larryk (Friar) on Apr 27, 2001 at 16:14 UTC |