> The method mentioned is to get the output while u are running the perl
> files
> at the shell prompt not in the code..
> if u want to save the log details after the perl files are processed then
> use this function
>
> sub file_write {
>     $_file = shift;
>     $_data = shift;
>     open FILE,">$_file";

three improvement for this "open":

1) use three arguments version of open.
2) use "my" variable for filehandle instead of a global symbol.
3) remember to capture error when open fails.

So it is better to write:

open my $fd, ">>", $file or die $!;

Also I think you mean the ">>" (append) mode instead of the ">" mode since
you are talking about logging.

Regards.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to