Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
And here is the code i have so far, that doesn't seem to work:Joe Bloggs,joe,Burton,joe@hotmail.com,google,80.10.10.123
I am sure there must be a better way of doing this, as this code looks very 'flakey' (and doesnt work), also i doubt it will exit gracefuly once all files are processed.#! /usr/bin/perl -T use warnings; use strict; @file = `ls /var/log/cr_user`; foreach $file { open(FILE, "/var/log/cr_user/$file") || die; @account=<FILE>; close(FILE); foreach $account { ($fullname, $username, $mothers, $email, $referral, $ip) = split(/ +,/, $account); print "$fullname $username $mothers $email $referral $ip"; } unlink $file; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Opening Unknown Filenames
by Aighearach (Initiate) on Jul 05, 2003 at 09:58 UTC | |
by diotalevi (Canon) on Jul 05, 2003 at 13:02 UTC | |
by Aighearach (Initiate) on Jul 06, 2003 at 03:42 UTC | |
by diotalevi (Canon) on Jul 06, 2003 at 03:59 UTC | |
by hiddenlinux (Acolyte) on Jul 05, 2003 at 10:33 UTC | |
by chromatic (Archbishop) on Jul 05, 2003 at 17:01 UTC | |
|
Re: Opening Unknown Filenames
by demerphq (Chancellor) on Jul 05, 2003 at 14:15 UTC | |
|
Re: Opening Unknown Filenames
by Limbic~Region (Chancellor) on Jul 05, 2003 at 12:21 UTC | |
|
Re: Opening Unknown Filenames
by Anonymous Monk on Jul 05, 2003 at 09:32 UTC | |
by jepri (Parson) on Jul 05, 2003 at 12:18 UTC | |
|