----- Original Message -----
From: "Ahmed Moustafa" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To: "Leon" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
> Can you open a file for reading and writing as the same time?
I have asked the question of can I read and write to the same file
simultaneously, such as this :-
open FILE, 'myfile.txt' or die "$!\n";
open FILE2, '>myfile.txt' or die "$!\n";
while (<FILE>){
# do some changes to $_;
print FILE2 $_;
};
but I did not get any response. Therefore I dont think we can do that.
---- end of msg -----
> Leon wrote:
>
> > There are many ways to do it. Some would use regexes or map. Anyway
heres
> > one solution assuming your file contain only 1 word in one line..
> >
> > open FILE, 'yourfile.txt' or die "$!\n";
> > while (<FILE>){
> > chomp;
> > $_ = "$_\@minime.com";
> > print "$_\n";
> > };
> > close FILE;
>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]