ramthen has asked for the wisdom of the Perl Monks concerning the following question:

New year wishes to all monks

Could any one pls. help me how to handle filehandles along with quote operators ?

I have a filehandle opened to write and would like to use qq operator while writing to that file ; sample code which is failing given below

print MK qq{some text here and some text here};

TIA

Replies are listed 'Best First'.
Re: Filehandles and quote operators
by reneeb (Chaplain) on Jan 03, 2005 at 14:24 UTC
    Is there any error message??

    This code works:
    #! /usr/bin/perl use strict; use warnings; my $file = 'print.test'; open(FILE,">$file") or die $!; print FILE qq{this is a test}; close FILE;
Re: Filehandles and quote operators
by thor (Priest) on Jan 03, 2005 at 15:18 UTC
    Assuming that MK is a valid filehandle, what you have there should work. Did you check return status of the open of MK?

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

Re: Filehandles and quote operators
by ramthen (Sexton) on Jan 03, 2005 at 16:26 UTC

    Thank you reneb and thor for your help

    Probably I needed some refresh!

    The code I wrote with filehandle and qq operator works now

    thanks

    Ram

      I would be nice if you shared your mistake/solution with your fellow monks (not in the least wit those who helped you find the problem).

      Sharing helps others too!

      Paul