fuzzyping has asked for the wisdom of the Perl Monks concerning the following question:
I guess it would be nice to put the loop inside its own sub (it's currently in the main flow), and then run some sort of true/false test on the state of <IN> from the filehandle. Any suggestions?#!/usr/bin/perl use strict; use DBI; my $dbh = DBI->connect_cached($dsn, $user, $pass); my $insert_stmt = "insert statement"; my $sth = $dbh->prepare($insert_stmt); open(IN, "tcpdump -nelttti pflog0 2>&1 |"); while (<IN>) { $sth->execute($stuff); } close(IN);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Keeping a loop alive
by Aristotle (Chancellor) on May 31, 2003 at 15:18 UTC | |
by fuzzyping (Chaplain) on May 31, 2003 at 16:12 UTC | |
by Aristotle (Chancellor) on May 31, 2003 at 16:17 UTC | |
by fuzzyping (Chaplain) on May 31, 2003 at 16:30 UTC |