in reply to putting text into array word by word
#! /usr/bin/perl open(FILE,"<input.txt"); print "file loaded \n"; my @lines=<FILE>; close(FILE); my @all_words; foreach my $line(@lines) { @temp_arr=split('\s',$line); push(@all_words,@temp_arr); } print "@all_words\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: putting text into array word by word
by jms53 (Monk) on Jan 09, 2012 at 18:35 UTC | |
by ansh batra (Friar) on Jan 09, 2012 at 18:39 UTC | |
by jms53 (Monk) on Jan 09, 2012 at 18:55 UTC | |
by Not_a_Number (Prior) on Jan 09, 2012 at 20:11 UTC | |
by jms53 (Monk) on Jan 09, 2012 at 23:19 UTC | |
|