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: Perl One-Liners: Multiple line task exection: Edit Log



preston3271
Novice

Sep 10, 2012, 12:26 PM


Views: 1487
Perl One-Liners: Multiple line task exection

Hello, Perl Kings and Queens!

I found Walter C. Mankowski's Essential One-Liners guide online and have found it to be great! I am move beyond the guides examples and need to know how to develop multiple task execution in a one liner:

For example:

Code
perl -lane ' `ping -n 3 $F[0]` ' pinglist.txt

Simple enough. But now I want to add a "For Loop," to the operation for $i 1 . . 5, and then sleep for 10 and continue.

How do you create that in a one-liner?

Okay I determined the following:


Code
# perl -lane ' for($i=0;$i<3;$i++){`ping -n 3 $F[1]`}' nodelistB.txt


But I want the code to advance one line unitil it gets to the <3 limit, pause, and then continue forward in the file.

hmm . . .


(This post was edited by preston3271 on Sep 10, 2012, 12:40 PM)


Edit Log:
Post edited by preston3271 (Novice) on Sep 10, 2012, 12:40 PM


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

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