Newbie: perl program in a ksh here-document

Discussion in 'Perl Misc' started by Jose Luis, Aug 12, 2009.

  1. Jose Luis

    Jose Luis Guest

    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
     
    Jose Luis, Aug 12, 2009
    #1
    1. Advertising

  2. 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.
     
    Alexander Bartolich, Aug 12, 2009
    #2
    1. Advertising

  3. 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
     
    RedGrittyBrick, Aug 12, 2009
    #3
  4. Jose Luis

    Jose Luis Guest

    On Aug 12, 2:54 pm, 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?
    >
    > Thanks in advance,
    > Jose Luis



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

    Regards,
    Jose Luis
     
    Jose Luis, Aug 13, 2009
    #4
    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. kaeli
    Replies:
    8
    Views:
    1,396
    Harald Kirsch
    Feb 13, 2004
  2. Replies:
    12
    Views:
    2,458
    Magnus Lycka
    Jun 8, 2005
  3. Andy Haupt
    Replies:
    1
    Views:
    128
    Chris Mattern
    Mar 24, 2005
  4. E Arredondo

    ksh after perl script

    E Arredondo, Oct 4, 2005, in forum: Perl Misc
    Replies:
    7
    Views:
    268
    Tintin
    Oct 5, 2005
  5. Replies:
    4
    Views:
    117
    Ben Morrow
    Apr 4, 2008
Loading...

Share This Page