in reply to Re: How to read contents of a file without opening it and print the contents
in thread How to read contents of a file without opening it and print the contents

I am attempting to fulfill an assignment that involves searching the file using regular expressions. "write a script called xxx.pl. This script should read the contents of /httpd/conf/httpd.conf without opening it and print out every line that contains /cgi-bin." So How does one "read a file without opening it?"
  • Comment on Re^2: How to read contents of a file without opening it and print the contents

Replies are listed 'Best First'.
Re^3: How to read contents of a file without opening it and print the contents
by LanX (Saint) on Jan 28, 2015 at 22:53 UTC
    It took you 4 years to return to this thread? Wow!

    Could it be that your assignment is rather HTTP than regex related?

    but even then .... a very stupid question.

    update

    maybe someone thought that using shell redirections do not open: $content=`<filename` ?

    update

    or $content=`cat filename` ?

    but even then .... a very stupid question!

    Cheers Rolf

    PS: Je suis Charlie!