Re: Parsing multi column files

2015-01-18 Thread Mike
Thanks for quick lesson and pro-tips. I'll be sure to implement some of these. In case you were wondering, I am indeed using strict and warnings. diagnostics, too. Thanks again. On 1/18/15 9:05 PM, Brandon McCaig wrote: Mike: On Sun, Jan 18, 2015 at 07:00:05PM -0500, Mike wrote: So I've g

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
Mike: On Sun, Jan 18, 2015 at 07:00:05PM -0500, Mike wrote: > So I've got a text file in a multi column format (three > columns), each column is separated by a single space. Here is a > snippet for reference: > > artless base-court apple-john > bawdy bat-fowling baggage > beslubbering beef-witted

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
On Sun, Jan 18, 2015 at 07:24:21PM -0500, Shawn H Corey wrote: > my @line = ( > @first[rand(@first)], > @second[rand(@second)], > @third[rand(@third)], >); Sorry to beat on you, Shawn, but I missed this the first time around. T

Re: Parsing multi column files

2015-01-18 Thread Charles DeRykus
On Sun, Jan 18, 2015 at 4:00 PM, Mike wrote: > So I've got a text file in a multi column format (three columns), each > column is separated by a single space. Here is a snippet for reference: > > artless base-court apple-john > bawdy bat-fowling baggage > beslubbering beef-witted barnacle > > I wa

Re: Parsing multi column files

2015-01-18 Thread Mike
Thanks. I'll give this a shot. On 1/18/15 7:44 PM, Brandon McCaig wrote: On Sun, Jan 18, 2015 at 07:24:21PM -0500, Shawn H Corey wrote: You would need an array for each column: my $MAX = 10; my @first = (); my @second = (); my @third = (); sub get_columns { my $file = shift @_; o

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
On Sun, Jan 18, 2015 at 07:24:21PM -0500, Shawn H Corey wrote: > You would need an array for each column: > > my $MAX = 10; > > my @first = (); > my @second = (); > my @third = (); > > sub get_columns { > my $file = shift @_; > > open my $fh, '<', $file or die "could not open $file: $!\

Re: Parsing multi column files

2015-01-18 Thread Shawn H Corey
On Sun, 18 Jan 2015 19:00:05 -0500 Mike wrote: > sub gen_ins { > open(FH, '<', 'insults2.txt') or die "[-] ERROR: Can't find > insult list."; > my @cols = split (" ", ); > print "$cols[0]"; > close FH; > } > > gen_ins(); > > When currently run, gen_ins() will print out the f

Parsing multi column files

2015-01-18 Thread Mike
So I've got a text file in a multi column format (three columns), each column is separated by a single space. Here is a snippet for reference: artless base-court apple-john bawdy bat-fowling baggage beslubbering beef-witted barnacle I want to be able to randomly select a word from the first col