hello everyone, since im learning perl, i might as well harness its power to solve my small real-world problem. sample lines of my grep'ped ppp log goes like this:
Jan 12 05:47:50 localhost pppd[8696]: Connect time 2.2 minutes. Jan 12 19:23:44 localhost pppd[9359]: Connect time 34.0 minutes. [..] Jan 17 14:12:06 localhost pppd[20127]: Connect time 12.6 minutes. Jan 17 17:17:12 localhost pppd[20398]: Connect time 21.1 minutes. [..] Feb 3 17:59:42 localhost pppd[22888]: Connect time 4.4 minutes. Feb 3 21:12:22 localhost pppd[23421]: Connect time 7.5 minutes. ^^^^^ i want to extract the time field on each line and get the sum total each time i end my net session (sort of estimating my time online). have started my perl script like this: #!/usr/bin/perl -w use strict; while (<>){ my $string = $_; my @string = split /\s+/, $string; print "$string[7]\n"; } exit; this just prints the time field on each line until finish of loop. i tried using += operator to get sum but i end up getting errors. how do i do this? i checked my script with perl's -c flag and it says syntax OK but i get errors when i run the script in command line: Use of uninitialized value in concatenation (.) or string at ./diamond-optr.pl line 15, <> line 20. Use of uninitialized value in concatenation (.) or string at ./diamond-optr.pl line 15, <> line 21. Use of uninitialized value in concatenation (.) or string at ./diamond-optr.pl line 15, <> line 22. this is printed in first 3 lines before printing the individual time fields. once i solve this problem i want the perl script to run each time i go offline, so i reckon this should be fired in ppp init file or something. this i dont know as well. kindly help. my home box is mandrake 9 and using wvdial in console to go online. TIA. -- Regards, Eri Mendz Using Perl, v5.8.0 Linux 2.4.19-16mdk i686 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]