Why not match?



Hello guys,

I have a simple code, but it doesn't work and don't know why. Please see it
below:

Input file: 1.txt which including number and letter "o" in one line.
10o10o10

Wanted output file: 2.txt in which 10 represent 10 dots and o is replaced
by letter "x".
..........x..........x..........x
The perl code I wrote is below:

#!/usr/bin/perl
use strict;
use warnings;

while(<>){
chomp;
if(/^10o|o10o|o10\z/){
s/10/.………/g;
}
s/o/x/g;
print"$_\n";
}

And the output file is like ".???x.???x.???" , So patter matching doesn't
work. Don't know why. Could you please give me some suggestion? Thank you
so much!

Xi


Relevant Pages

  • Re: Help is needed to compile C program using Visual Studie 2005
    ... the pdb file that was used when this precompiled header was created, ... an output file whose name has the following format: ... The length of input file paths and name must be less than 256; ... while(i < DefinedVariableArrayIndex) { ...
    (microsoft.public.vc.language)
  • Re: Need advice on File I/O
    ... open the input file and open an output file, ... you would still have the input file unchanged. ... On all currently supported operating systems, ...
    (comp.soft-sys.matlab)
  • Re: Difficult text file to parse.
    ... > records are which there are only two, look at the output file below to ... I want to show the delimiters even if ... > My sample Input file: ... [sample input and output files with long fields snipped] ...
    (comp.lang.perl.misc)