Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Newbie: perl program in a ksh here-document (http://www.velocityreviews.com/forums/t911201-newbie-perl-program-in-a-ksh-here-document.html)

Jose Luis 08-12-2009 12:54 PM

Newbie: perl program in a ksh here-document
 
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






Alexander Bartolich 08-12-2009 01:39 PM

Re: Newbie: perl program in a ksh here-document
 
Jose Luis wrote:
> [...]
> 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«?

--
Brüder, in die Tonne die Freiheit,
Brüder, ein Stoppschild davor.
Egal was die Schwarzen Verlangen
Rufen wir: Ja! Brav im Chor.

RedGrittyBrick 08-12-2009 02:08 PM

Re: Newbie: perl program in a ksh here-document
 

Jose Luis wrote:
> 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.


--
RGB

Jose Luis 08-13-2009 06:42 AM

Re: Newbie: perl program in a ksh here-document
 
On Aug 12, 2:54*pm, Jose Luis <jose.luis.fdez.d...@gmail.com> wrote:
> 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


All times are GMT. The time now is 01:04 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.