Loading ...
Sorry, an error occurred while loading the content.

open() and |

Expand Messages
  • Hudson T Clark
    Ok well I know that if you put | before the string you feed open() will make it execute as a command. Well when I set the mode to read like this open FILE,
    Message 1 of 2 , Apr 17, 2003
    • 0 Attachment
      Ok well I know that if you put | before the string you feed open() will
      make it execute as a command. Well when I set the mode to read like this

      open FILE, "<somefile.txt";

      I can't pipe commands anymore... any ideas?
    • Damien Carbery
      ... will ... this ... I believe this is not working because
      Message 2 of 2 , Apr 19, 2003
      • 0 Attachment
        --- In perl-beginner@yahoogroups.com, Hudson T Clark
        <dark_archon1@j...> wrote:
        > Ok well I know that if you put | before the string you feed open()
        will
        > make it execute as a command. Well when I set the mode to read like
        this
        >
        > open FILE, "<somefile.txt";
        >
        > I can't pipe commands anymore... any ideas?

        I believe this is not working because '< somefile.txt' is something
        the shell understands.
        I think you'll get the desired result using:

        open FILE, "| cat somefile.txt";

        or you could simple open the file as normal and read it.
      Your message has been successfully submitted and would be delivered to recipients shortly.