help with perl code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mike

    help with perl code

    hi
    i have written some perl code like this

    $telnetcmd << "EOF";
    perl -ne "chdir(/tmp); while ($file = <*.txt>) { print stat($file); }"
    EOF
    print $telnetcmd;

    it give me some errors:

    syntax error at ./test.pl line 3, near "-ne"
    Semicolon seems to be missing at ./test.pl line 3.
    Execution of ./test.pl aborted due to compilation errors.


    what is wrong with the code...?? thanks
  • nobull@mail.com

    #2
    Re: help with perl code

    s99999999s2003@ yahoo.com (mike) wrote in message news:<dfd17ef4. 0312302057.3db1 d68c@posting.go ogle.com>...[color=blue]
    >
    > $telnetcmd << "EOF";
    > perl -ne "chdir(/tmp); while ($file = <*.txt>) { print stat($file); }"
    > EOF
    > print $telnetcmd;
    >
    > it give me some errors:
    >
    > syntax error at ./test.pl line 3, near "-ne"
    > Semicolon seems to be missing at ./test.pl line 3.
    > Execution of ./test.pl aborted due to compilation errors.
    >
    >
    > what is wrong with the code...?? thanks[/color]

    You meant:

    $telnetcmd = << "EOF";

    Actually I suspect you didn't what $file interpolated so you meant:

    $telnetcmd = << 'EOF';

    Actually, come to think of it, if you don't like wasting your time
    hunting down obscure bugs, you probably should have said:

    use strict;
    use warnings;
    my $telnetcmd = << 'EOF';

    This newsgroup does not exist (see FAQ). Please do not start threads
    here.

    Comment

    Working...