FAQ
Hi there,

I have the following problem:

I want to read a logfile in which every line follows this rule:
<value1>:<value2>:<value3>...

But the number of values differs. Sometimes a line has 2 values (the
minimum) and sometimes 3 or more values. Now I want to push these
values into a hash that follows that form:
$hash->{value1}->{value2}...

This is what I have so far:

sub readLog {
my $self = shift;
my $logfile = getFilename();

open LOG, "<$logfile";

foreach my $line (<LOG>) {
my @values = split /\:/, $line;
... # at this point I don't know what to do :(
}
}

Greetings
Dennis

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
groupbeginners @
categoriesperl
postedDec 1, '10 at 9:24a
activeDec 1, '10 at 10:56a
posts4
users3
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase