Web Solving <[EMAIL PROTECTED]> wrote:
: while (<READIT> || <INFILE>) {
: $riga = $_;
What did you think this would do? It is common to read from one
file at a time. "while ( my $riga = <READIT> ) {" or
"while ( my $riga = <INFILE> ) {". What were you hoping to accomplish
with this? What do you think is in $_? Have you tested it?
: my ($search, $replace) = split /|/;
The pipe '|' in a regular expression has a special meaning.
You probably meant this, which escapes the pipe to let perl know
we want to split on that character.
As written here, I don't believe anything will be in $_. My
tests revealed the while loop ran only once. It might be different
depending on file contents, but I don't think so. With nothing in
$_ (and nothing in $riga) there is no chance that this script
will produce output.
# check for valid line
next unless /\|/;
my ($search, $replace) = split /\|/;
: $riga =~ s/$search/$replace/;
If nothing is in $replace and if warnings are turned off, no
uninitialized value error will print and every occurrence of $search,
which is the whole line, will be replaced with nothing.
: print WRITEIT "$riga\n";
Assuming $riga does not have a pipe delimited record in it, this
will append "\n" to the testo_new.txt file.
: }
: close(WRITEIT);
: close(READIT);
: close(INFILE);
:
: as result of this script i've a blank testo_new.txt file .
: anyone can help me?
Perl has probably done exactly what you asked of it. Telling us
what you expect would aid us in helping you further.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>