On 12/15/09 Tue Dec 15, 2009 7:42 AM, "A4r0N" <[email protected]>
scribbled:
> I need to add "new lines" of text with special characters, to specific
> lines in the file. There are 3 modifications needed. Been testing 2
> here without success.
>
> #!/usr/bin/perl
>
> use FileHandle;
> $file=FileHandle->new;
> $FILENAME="/opt/etc/usr/file.txt";
> $file->open ("<$FILENAME") or die ("Error: $!\n");
> while (<$file>) {
> $count++;
> if ($count=39) {
That should be: if($count==39) {
> print qq[RM="rm2"];}
You probably want a newline at the end: print qq[RM="rm2"\n];
> if ($count=47) {
> print qq[$RM]
Ditto for the above two lines.
> }
> exit;
>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/