On Jun 30, 5:38 pm, [EMAIL PROTECTED] (Rob Dixon) wrote:
> onlineviewer wrote:
>
> > Can someone tell me the proper syntax to print out the value in a
> > reference?
> > Thank you.,,
>
> I'm not sure what you mean. Look:
>
> > my $string = '';
> > open my $scalar_fh, '>>', \$string;
>
> So you have opened a file handle to append to the scalar $string.
>
> > my $log_message = "here is my string...";
> > print $scalar_fh $log_message;
>
> And now you have printed "here is my string..." to that file handle. If you
> examine the contents of $string you will see that it has worked.
>
> Now $string eq "here is my string..." and $scalar_fh is a file handle (a glob
> reference) so I don't understand what you're trying to do here.
>
> > foreach my $fh ($scalar_fh) {
> >         print "$fh";
>
> > }
>
> There is only one item in your list, $scalar_fh, so the loop is executed once,
> and it is the same as
>
>   print "$scalar_fh";
>
> Perl tries its best to display the value of the file handle, but it's not a 
> very
> meaningful thing to do.
>
> Do you mean just this?
>
>   print $string, "\n";
>
> HTH,
>
> Rob

Yes i confused myself...

Thanks,


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


Reply via email to