Newbie: perl program in a ksh here-document

J

Jose Luis

Hi,

#/usr/bin/ksh


cat kk|perl - <<-"EOF"

use strict;
use warnings;


while(<STDIN>)
{
print "$_";
}


EOF



The shell script program above doesn't print on screen the file "kk".
Any help?


Thanks in advance,
Jose Luis
 
A

Alexander Bartolich

Jose said:
[...]
cat kk|perl - <<-"EOF"
[...]

The shell script program above doesn't print on screen the file "kk".

I guess you are confusing »cat« with »echo«. Or do you actually have
a filed called »kk« containing nothing but the line »kk«?
 
R

RedGrittyBrick

Jose said:
Hi,

#/usr/bin/ksh


cat kk|perl - <<-"EOF"

use strict;
use warnings;


while(<STDIN>)
{
print "$_";
}


EOF



The shell script program above doesn't print on screen the file "kk".
Any help?

$ cat t.ksh
#!/bin/ksh
perl - kk<<EOF
use strict;
use warnings;
while(<>) {
print "\$_";
}
EOF

$ ./t.ksh
This is
what's in
file kk.


....


$ cat t.ksh
#!/bin/ksh
perl - kk<<EOF
use strict;
use warnings;
while(<>) {
print;
}
EOF

$ ./t.ksh
This is
what's in
file kk.
 
J

Jose Luis

Hi,

#/usr/bin/ksh

cat kk|perl - <<-"EOF"

use strict;
use warnings;

while(<STDIN>)
{
print "$_";

}

EOF

The shell script program above doesn't print on screen the file "kk".
Any help?

Thanks in advance,
Jose Luis


This can be solved with the -e perl's option.

Regards,
Jose Luis
 

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,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top