$MSG is a link http://www.foo.com/dpt/index.html

Is there anything else other than EOF, that can cause a while loop to exit
when reading file?
Thanks
Aman

----- Original Message -----
From: "David T-G" <[EMAIL PROTECTED]>
To: "perl beginners" <[EMAIL PROTECTED]>
Cc: "aman cgiperl" <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 12:49 PM
Subject: Re: file read and then write problem

aman --

....and then aman cgiperl said...
%
% here's the code.

Well, a snippet, anyway.


% the file that I am reading is an html file generated by similar code
%
% open PAGIN, "/$path/index_tmp.html";
% open PAGOUT, ">/$path/index.html";
% while(<PAGIN>)  {
%     $_ =~ s/##UF##/$MSG/g;
%     print PAGOUT $_;
% }

Looks fine to me.  The only thing that comes to mind is that your $MSG
might have some expr-matching characters which bomb somehow.

Meanwhile, I have to wonder why you're modifying $_ in the loop.  I
haven't tested this (and so I know I'm gonna get burned), but why not
just

  while (<PAGIN>)
  {
    print PAGOUT s/##UF##/$MSG/g;
  }

instead?


%
% I can't send the html file w/o permission from my workplace. I hope you
% understand and can help.

I understand, but you still don't give us a lot with which to work :-)


% Thanks
% Aman


HTH & HAND

:-D
--
David T-G                      * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to