ellem has asked for the wisdom of the Perl Monks concerning the following question:
remove all the spaces and then transliterate them as shown in the code below:Fred Flintstone Barney Rubble Dino The Dinosaur
My code is NOT removing the spaces. I have also tried $name =~ s/\+s//g;#!/usr/bin/perl use warnings ; use diagnostics ; use strict ; open (LIST, "sn.txt") or die "No file exists: $!" ; open (NEWFILE, '+> C:/Lou/Perl_Scripts/code/perl/pwd.txt') or die "Can +'t open file; $!" ; #I am intentionally erasing the file pwd.txt my($cname, $name, $pwd); while(<LIST>) { chomp; $cname = $name = $_ ; $name =~ s/\s//g; $name = $pwd = $_ ; $pwd =~ tr [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw +xyz] [2223334445556667778889990022233344455566677788899 +900] ; write NEWFILE ; } close LIST or die "Can't close file: $!" ; close NEWFILE or die "Can't close file: $!" ; format NEWFILE_TOP = ------ ------ NAME PWD ------ ------ . format NEWFILE = @<<<<< @<<<<< $name, $pwd .
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Removing Spaces From A File
by VSarkiss (Monsignor) on Mar 04, 2003 at 16:15 UTC | |
by ellem (Hermit) on Mar 04, 2003 at 16:24 UTC | |
by VSarkiss (Monsignor) on Mar 04, 2003 at 16:30 UTC | |
by ellem (Hermit) on Mar 04, 2003 at 17:08 UTC | |
|
Re: Removing Spaces From A File
by xmath (Hermit) on Mar 04, 2003 at 16:24 UTC | |
by ellem (Hermit) on Mar 04, 2003 at 16:30 UTC | |
|
Re: Removing Spaces From A File
by Anonymous Monk on Mar 05, 2003 at 17:55 UTC |