help with perl code

M

mike

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
 
N

nobull

$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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top