in reply to How to read each line of file into an array and split contnts of each line into array cells

Show us what you have tried (even if it failed).

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics
  • Comment on Re: How to read each line of file into an array and split contnts of each line into array cells

Replies are listed 'Best First'.
Re^2: How to read each line of file into an array and split contnts of each line into array cells
by crazy-duck (Novice) on Sep 30, 2013 at 11:03 UTC
    #!/usr/bin/perl; use strict; use warnings; use Getopt::Long; my @ARRAY = (); my $ARRAYlength = -1; my $FILEname="/var/log/logfile.txt"; open FILE, $FILEname or die "couldn't open $FILEname: $!"; while (<FILE>) { @ARRAY = <FILE>; print "@ARRAY\n" } close FILE or die "problems closing $FILEname: $!";,<

    Output of above script: **FAILED PROD** - BUGS - 08/26/13 @11:12 - BUGS~23AUG13~23AUG13~23AUG13~26AUG13~1109

    **FAILED PROD** - cockroach - 08/29/13 @11:52 -cockroach~29AUG13~29AUG13~29AUG13~29AUG13~1152

    Iam able to read the logfile lines into array and at this point I want to split components of each line and check the time and alert if it is between 18hrs to 6AM following day.