Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Help with Regular Expressions and Perl

by Punitha (Priest)
on Apr 01, 2010 at 04:45 UTC ( #832202=note: print w/replies, xml ) Need Help??


in reply to Re: Help with Regular Expressions and Perl
in thread Help with Regular Expressions and Perl

Hi,

You are processing a single file (reading and writing in the same file), so please check the input file content in every execution (may be you are reading the blank file) or try link this,

use strict; use warnings; open(INFILE, "<perlfile.txt"); my @variable; my $variable = join("\n", @variable = <INFILE>); close(INFILE); open(OUTFILE, ">perlfile_out.txt"); $variable =~ s/0/zero/g ; $variable =~ s/1/one/g ; $variable =~ s/2/two/g ; $variable =~ s/3/three/g ; $variable =~ s/4/four/g ; $variable =~ s/5/five/g ; $variable =~ s/6/six/g ; $variable =~ s/7/seven/g ; $variable =~ s/8/eight/g ; $variable =~ s/9/nine/g ; print OUTFILE "$variable"; close(OUTFILE);

Punitha

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://832202]
help
Chatterbox?
[marioroy]: bad gurus :)
[choroba]: also, &> redirects both at the same time
[marioroy]: erix are you using csh
Discipulus uh the link was for cmd.exe the bash one
[marioroy]: If yes, for redirection to work, one might do the following
[marioroy]: `bash -c "clang --version 2>/dev/null"`
[choroba]: Sane people don't use csh
[marioroy]: the 1>&2 will work, not shown
[marioroy]: sorry, did not know which if cmd.exe or unix (bash)
[choroba]: csh considered harmful

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2017-03-23 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (284 votes). Check out past polls.