Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
i have tried the following but it doesn't work!12 data data data 12 data data data
help!#! /usr/local/bin/perl -w use strict; open (FH, $ARGV[0]) or die "unable to open file"; open (OUTFILE, ">$ARGV[1]"); my $line; my @array; while (<FH>) { $line = $_; # remove the newline characters from variable $line; chomp ($line); # @array = (); # remove a single whitespace from the start of lines foreach $line (@array) { $line =~ s/\s{1}//g; } @array = split (/\s+/, $line); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problems with arrays
by Aristotle (Chancellor) on Jun 20, 2002 at 10:14 UTC | |
by Anonymous Monk on Jun 20, 2002 at 12:28 UTC | |
|
(wil) Re: problems with arrays
by wil (Priest) on Jun 20, 2002 at 09:50 UTC | |
|
Re: problems with arrays
by bronto (Priest) on Jun 20, 2002 at 12:26 UTC | |
|
Re: problems with arrays
by schumi (Hermit) on Jun 20, 2002 at 09:52 UTC | |
|
Re: problems with arrays
by husker (Chaplain) on Jun 20, 2002 at 14:47 UTC |