On 1 Nov 2007 at 19:43, Kaushal Shriyan wrote:

> Thanks Rob
> 
> Its working Fine, Now when I am using the below code to write something to
> file "messages"
> the below code is not writing the text "write some text " to the file
> messages.
> 
> ##############################################
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> open(LOGFILE, "messages")
>         || warn "Could not open messages.\n";
> open(DATA, ">/tmp/data") || die "Could not create /tmp/data\n.";
> 
> print LOGFILE "write some text ";
> 
> ##############################################
> 
> when i do a less messages, i see there is no text "write some text" at the
> end of the file.
> 
> what I am doing wrong.

Trying to redeem myself!

You have opened LOGFILE as readonly and then printed to it. I would 
have expected an error message about this. I think you want:

print DATA "write some text";

Dp.
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to