51 users online (0 members and 51 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 0
  2. Running external program from CGI/Perl    Forum: CGI Perl Forum
    Replies: 2
  3. Perl commands in an input file to cgi script    Forum: CGI Perl Forum
    Replies: 0
  4. Running a batch script file from Perl CGI    Forum: CGI Perl Forum
    Replies: 0
  5. I am running a *ree online perl workshop    Forum: CGI Perl Forum
    Replies: 2
  1. #1
    blink's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2005
    Posts
    19

    Running shell commands from Perl

    Hello,

    I have a webhotel which allows me to run Perl scripts. I have a log file which i want to grep and count unqiue entries. In shell I can do it this way:

    grep data file.dat | sort | uniq | wc -l

    On other server I have done this the following way:

    my $unique_count = 'grep data file.dat | sort | uniq | wc -l'

    But on the current server what I get as the value is the String of the shell command. How can I do similar task in Perl commands?

  2. #2
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382

    Re: Running shell commands from Perl

    you could try using "system()" or "exec()" (i dont have verry much experiance with stuff like that, so i cant help you much)



Tags for this Thread