in reply to Opening Unknown Filenames
#!/usr/bin/perl -Tw use strict; my @data; my @Files = grep { ! -d } </var/log/cr_user/*>; while (my $file = shift @Files) { unless (open (FILE,"$file")) { # Tell yourself instead of deleting it next; { while (<FILE>) { my @fields = split /,/; push @data , \@fields; } unlink $file; } foreach my $a_ref (@data) { print "Full Name = $a_ref->[0]\n"; print "User Name = $a_ref->[1]\n"; print "Mothers = $a_ref->[2]\n"; print "Email = $a_ref->[3]\n"; print "Referral = $a_ref->[4]\n"; print "IP = $a_ref->[5]\n"; }
You could use a different data structe if you wanted. Additionally, if the data really is comma delimited then you should consider one of the CSV modules on CPAN since an imbedded comma will cause the code will not work properly.
Cheers - L~R
|
|---|