Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Removing Spaces From A File

by ellem (Hermit)
on Mar 04, 2003 at 16:24 UTC ( [id://240406]=note: print w/replies, xml ) Need Help??


in reply to Re: Removing Spaces From A File
in thread Removing Spaces From A File

Because it writes this
------ ------ NAME PWD ------ ------ Fred F 3733 3 Barney 227630 Dino T 3466 8
I guess I am doing something else incorrectly. Thanks anyway.
--
ellem@optonline.net
There's more than one way to do it, but only some of them actually work.

Replies are listed 'Best First'.
Re (3): Removing Spaces From A File
by VSarkiss (Monsignor) on Mar 04, 2003 at 16:30 UTC

    The point is, after you remove the blanks in $name, you then assign a new value to it before doing the write. The output you're seeing is the result of that second assignment, not the result of the substition.

    As xmath points out below, you're copying around a lot of stuff, and it's not clear why. You may need to rethink part of your algorithm.

      Here's what I got:
      my($name, $pwd); while(<LIST>) { chomp; $name = $pwd = $_ ; $name =~ s/\s//g ; $pwd =~ s/\s//g ; $pwd =~ tr [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw +xyz] [2223334445556667778889990022233344455566677788899 +900] ; write NEWFILE ; }
      Seems like it is a little clunky. Not the way I imagined it but it does work. I was thinking more along the lines of:

      Aaaa aaaa --> Aaaaaaaa --> 222222222 --> 22222
      $name ------> $name -----> $pwd -------> Output
      Read file --> Remove spaces -> Transliterate -> Print file
      --
      ellem@optonline.net
      There's more than one way to do it, but only some of them actually work.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://240406]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-24 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found