CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Convert shell head command to Perl

 



digioleg54
User

Apr 20, 2017, 8:41 AM

Post #1 of 2 (639 views)
Convert shell head command to Perl Can't Post

In my CGI script I have

Code
$_ = `head -1 $finfo`;


How can I made this line as Perl? I run it on Apache

Thanks


FishMonger
Veteran / Moderator

Apr 20, 2017, 9:21 AM

Post #2 of 2 (635 views)
Re: [digioleg54] Convert shell head command to Perl [In reply to] Can't Post

You need to do it in 2 or 3 statements depending on if you explicitly close the file or not.

1) use the open function to open the file.
2) read the 1st line into your var.
3) (optional) close the file.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives