On Thursday 06 May 2010, Rob Coops wrote:
> Of course and a system like nagios does exactly that, it reports errors and
> positives, mail is of course not the way right to deal with monitoring
> certainly in large environments it is simply not done via mail. Currently
> looking at the monitoring sy
> "APK" == Akhthar Parvez K writes:
APK> Thanks for the explanation John. Could you give one or two real
APK> time examples where you used a list (instead of an array) except
APK> in loops such as: for ('a', 'b', 'c', 'd')? I wonder if I'm
APK> underusing lists in my Perl programs.
i
On Wednesday 05 May 2010, John W. Krahn wrote:
> > If I could explain this further for Perl beginners:
> > With that foreach statement, it reads the file first and creates an
> > array with each line as elements and that array is being looped so the
> > overhead is higher, whereas with that while s
On Wed, May 5, 2010 at 8:50 PM, Akhthar Parvez K
wrote:
> On Wednesday 05 May 2010, Rob Coops wrote:
> >
> > A file never starts life being huge but certainly logs tend to grow, and
> > they are not always kept in check properly so assume they will be massive
> > (I've seen flat text logs that gre
On Wednesday 05 May 2010, Rob Coops wrote:
>
> A file never starts life being huge but certainly logs tend to grow, and
> they are not always kept in check properly so assume they will be massive
> (I've seen flat text logs that grew by as much as +1GB per day) assuming
> that the file will always
On Wed, May 5, 2010 at 7:21 PM, Akhthar Parvez K
wrote:
> On Wednesday 05 May 2010, Rob Coops wrote:
> > Would it not be more efficient to reset the file handle to the star of
> the
> > file?
> >
> > use strict;
> > use warnings;
> > use Fcntl qw(:seek);
> > ...
> > foreach my $condition (@conditi
On Wednesday 05 May 2010, Rob Coops wrote:
> Would it not be more efficient to reset the file handle to the star of the
> file?
>
> use strict;
> use warnings;
> use Fcntl qw(:seek);
> ...
> foreach my $condition (@conditions) {
> seek ( $fh, 0, 0 ) or die "ERROR: Could not reset file handle\n";
Akhthar Parvez K wrote:
On Wednesday 05 May 2010, Shawn H Corey wrote:
Brian wrote:
foreach $line () {
while (my $line = <$logfile>) would be a better idea than foreach $line.
Just curious for an explanation to this. I tend to use foreach too.
Don't they both accomplish the same thin
On Wed, May 5, 2010 at 10:18 AM, Shlomi Fish wrote:
> Hi Paul,
>
> a few comments on your code - so you'll know how to write Perl better.
>
> On Wednesday 05 May 2010 02:52:03 Paul Fontenot wrote:
> > Hi,
> >
> > I'm stuck on using an array to determine the out come of a foreach loop.
> > The scr
On Wednesday 05 May 2010, Shawn H Corey wrote:
> Brian wrote:
> >>
> >>> foreach $line () {
> >> while (my $line = <$logfile>) would be a better idea than foreach $line.
> >>
> >
> > Just curious for an explanation to this. I tend to use foreach too. Don't
> > they both accomplish the sam
On Wednesday 05 May 2010, Shlomi Fish wrote:
> > Wouldn't there be any issues if we use same name for lexical filehandle and
> > the scalar variable. Is Perl too intelligent to recognize both of them?
>
> There certainly would be, and I don't think Perl is that intelligent to
> multiplex between
On Wednesday 05 May 2010 17:20:25 Akhthar Parvez K wrote:
> On Wednesday 05 May 2010, Shlomi Fish wrote:
> > 2. Don't use bareword filehandles - use lexical ones:
> >
> > open(my $output, ">>", $output) or die "Could not append to output - $!";
>
> Wouldn't there be any issues if we use same name
On Wednesday 05 May 2010, Shlomi Fish wrote:
> 2. Don't use bareword filehandles - use lexical ones:
>
> open(my $output, ">>", $output) or die "Could not append to output - $!";
Wouldn't there be any issues if we use same name for lexical filehandle and the
scalar variable. Is Perl too intellig
Thomas Bätzler wrote:
Brian asked:
foreach $line () {
while (my $line = <$logfile>) would be a better idea than
foreach $line.
Just curious for an explanation to this. I tend to use foreach too.
Don't they both accomplish the same thing? :)
"foreach ()" means that the whole file w
Brian wrote:
foreach $line () {
while (my $line = <$logfile>) would be a better idea than foreach $line.
Just curious for an explanation to this. I tend to use foreach too. Don't they
both accomplish the same thing? :)
Yes, but they go about it in different ways. The foreach lo
Brian asked:
> >> foreach $line () {
> >
> > while (my $line = <$logfile>) would be a better idea than
> > foreach $line.
>
> Just curious for an explanation to this. I tend to use foreach too.
> Don't they both accomplish the same thing? :)
"foreach ()" means that the whole file will
>
>
>>
>> foreach $line () {
>
> while (my $line = <$logfile>) would be a better idea than foreach $line.
>
Just curious for an explanation to this. I tend to use foreach too. Don't they
both accomplish the same thing? :)
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
Fo
Hi Paul,
a few comments on your code - so you'll know how to write Perl better.
On Wednesday 05 May 2010 02:52:03 Paul Fontenot wrote:
> Hi,
>
> I'm stuck on using an array to determine the out come of a foreach loop.
> The script is below.
> -
> "JG" == Jim Gibson writes:
JG> On 5/4/10 Tue May 4, 2010 4:52 PM, "Paul Fontenot"
JG> scribbled:
JG> You need to reset LOGFILE to the beginning for subsequent
JG> iterations over the @conditions array. As written, the nested
JG> foreach will never be executed except for the fi
Thank you very much
On 5/4/2010 6:12 PM, Shawn H Corey wrote:
Jim Gibson wrote:
You need to reset LOGFILE to the beginning for subsequent iterations
over
the @conditions array. As written, the nested foreach will never be
executed
except for the first condition. Add the indicated seek call.
Jim Gibson wrote:
You need to reset LOGFILE to the beginning for subsequent iterations over
the @conditions array. As written, the nested foreach will never be executed
except for the first condition. Add the indicated seek call.
The actual command is seek. See `perldoc -f seek` or
http://per
On 5/4/10 Tue May 4, 2010 4:52 PM, "Paul Fontenot"
scribbled:
> Hi,
>
> I'm stuck on using an array to determine the out come of a foreach loop.
> The script is below.
> --
> --
> #!/usr/bin
Hi,
I'm stuck on using an array to determine the out come of a foreach loop.
The script is below.
#!/usr/bin/perl
#
@conditions = ("NET", "eth");
$hostname = (`/bin/hostname`);
$logfil
23 matches
Mail list logo