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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Perl One-Liners: Multiple line task exection: Edit Log


Sep 10, 2012, 12:26 PM

Views: 1579
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:

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:

# 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