help with perl code

Discussion in 'Perl' started by mike, Dec 31, 2003.

  1. mike

    mike Guest

    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
    mike, Dec 31, 2003
    #1
    1. Advertising

  2. mike

    Guest

    (mike) wrote in message news:<>...
    >
    > $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


    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.
    , Jan 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,791
  2. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Jan 23, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    297
    PerlFAQ Server
    Jan 23, 2011
  3. PerlFAQ Server
    Replies:
    0
    Views:
    677
    PerlFAQ Server
    Feb 3, 2011
  4. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Feb 27, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    291
    PerlFAQ Server
    Feb 27, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    679
    PerlFAQ Server
    Apr 4, 2011
Loading...

Share This Page