in reply to Re^6: how to create a perl program using filehandle and streams ?
in thread how to create a perl program using filehandle and streams ?

"Wow! when i run the following script then hello! can be seen inside "not.txt" file after once scrip is run."

I've already questioned why you'd want to do this, you didn't answer.

"it means book assumed me as knower of perl so it didn't mentioned to write:..."

I have no idea what book you're talking about. For all I know this is explained in a previous section of the text. It's also possible that you didn't follow the books written instructions properly. I don't believe the book told you to save the perl script as not.txt, which the example script overwrites.

  • Comment on Re^7: how to create a perl program using filehandle and streams ?

Replies are listed 'Best First'.
Re^8: how to create a perl program using filehandle and streams ?
by GrandFather (Saint) on Apr 02, 2011 at 22:13 UTC
    I don't believe the book told you to save the perl script as not.txt, which the example script overwrites.

    Maybe the book was just trying to see how dumb the reader was as a way of eliminating those not suitable for learning to program?

    True laziness is hard work
Re^8: how to create a perl program using filehandle and streams ?
by Monk_perl (Initiate) on Apr 01, 2011 at 10:42 UTC

    I am talking about perl black book. Actually i just wanted to run this script & to know about what FILEHANDLE does in the script by running.

      Here you mention you have "some chapters" from this book, and that some of the print is bad. You've been given links several times now to up to date Perl documentation as well as tutorials and other resources for learning Perl. IMHO this is a better starting than some extracts of dubious (print) quality.

        I have created following code to display hello! on command line screen

        use strict; use warnings; use diagnostics; open (DOG, ">not.txt") or die ("Cannot open not.txt"); print DOG "hello!"; open (DOG, "<not.txt") or die ("Cannot open not.txt"); while(<DOG>){ print;} close (DOG);

        And with previous code

        use strict; use warnings; use diagnostics; open (DOG, ">not.txt") or die ("Cannot open not.txt"); print DOG "hello!"; close (DOG);

        I was thinking that the code only creates file and doesnot display contents of file on the command line screen.