in reply to Re: matching paragraphs
in thread matching paragraphs

Thanks for your reply! How do I get the input in? The file is in the same folder and thus far I have only learnt how to work from standard input using a while loop e.g.
while ($line =<>); etc.
I cannot see where the input is coming from? Apologies for my lack of understanding!!!!

Replies are listed 'Best First'.
Re^3: matching paragraphs
by starbolin (Hermit) on Apr 19, 2005 at 05:57 UTC
    • <> is an abreviation for < ARGV> and takes a filespec from the command line.
    • < STDIN> reads from STDIO,
      open FH, /dev/null or die "Can't open file\n"; while <FH> { #your code }
      This code sais: open the file /dev/null and give me a filehandle FH as a reference. Then read from the file referenced by FH and put that into $_. Stop reading at the end of the file.

      Reread post and ammended:

      imhotep wrote:

      #The variable, input in this case being #standard input

      That is wrong. You opened input.txt and created a filehandle INPUT. You are reading from input.txt.


      s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}