On Tue, Nov 11, 2008 at 9:52 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi I am new to this group and to Perl.
>
 [snip]

> #!/usr/bin/perl -w
> use strict;
>

If you really have warnings enabled, you should be seeing lots of
warnings like "bareword found where operator expected" pointing at
this line:

>
> 's/$search/$replace/g' $input >> $output;
>

The problem is that this isn't valid Perl code. For starters, in Perl,
">>" is the binary shift operator, not the "append to file" operator.
Also, matches and substitutions are performed via the binding
operator; your code looks as if you've pasted in some shell code that
uses sed. You need to do something along the lines of:

$input =~ s/search/$replace/g;

on each line of your input file.

Then you need to print the modified text to file:

open my $outfile, '>>', $output;
print $outfile $modified_text;
close $outfile;

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.downloadsquad.com  http://www.engatiki.org

values of β will give rise to dom!

Reply via email to