in reply to Re: Input files <>
in thread Input files <>

Thank you VinsWorld, I expected to see the contents of @raw. Which sould be two sentences. The file.txt that was the source input contained two sentences. On the command line I type in the pl script blank space and file.txt. I hit return.The curser moves to next line on command screen and stays there forever. ostra

Replies are listed 'Best First'.
Re^3: Input files <>
by JavaFan (Canon) on Apr 03, 2012 at 18:27 UTC
    As far as I can deduce from your program (which isn't inside of <code> tags, so very hard to read), @raw will be assigned the current line. @raw will never contain more than one line. Finally, when all input is seen, @raw is printed. And hence, will print the final line of the input.
      Thank you for your reply. But I don't see the final line-i don't see anything.
Re^3: Input files <>
by davido (Cardinal) on Apr 04, 2012 at 07:48 UTC

    Can you please show us the exact command you are using to invoke the script?


    Dave

      Dave thank you for getting back to me. The command is written as follows: namelist.pl names.txt Ostra
        This is the script that I am using:
        #!/usr/bin/perl -w use strict; my $input=''; my @raw=(); while(defined ($input=<>)){ chomp($input); @raw=$input; } print "@raw\n";
        names.txt contents are: I am going home. When are you leaving? Any feedback will be appreciated. Ostra

        Code tags added by GrandFather