monaghan has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; my $teststring = "Hello CPLD this is just a test that I have created n +ow.\n"; print $teststring; my $file = "./acrolist.txt"; open (FILE,$file) || die "Can't open file \"$file\".\n"; my @raw_data=<FILE>; my $rawdata; my @newrawdata = (); my $newrawdata; print @raw_data; foreach $rawdata(@raw_data) { if ($teststring =~ m/$rawdata/) { print "You have a MATCH!\n"; #print $1; $newrawdata[@newrawdata] = $rawdata; } } print @newrawdata;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: returning matched word from string
by BrowserUk (Patriarch) on Jul 22, 2008 at 23:55 UTC | |
|
Re: returning matched word from string
by ww (Archbishop) on Jul 23, 2008 at 00:08 UTC | |
|
Re: returning matched word from string
by Lawliet (Curate) on Jul 22, 2008 at 23:58 UTC | |
by toolic (Bishop) on Jul 23, 2008 at 00:53 UTC | |
by Lawliet (Curate) on Jul 23, 2008 at 01:13 UTC | |
by monaghan (Novice) on Jul 23, 2008 at 00:40 UTC | |
by ikegami (Patriarch) on Jul 23, 2008 at 01:01 UTC | |
by monaghan (Novice) on Jul 23, 2008 at 18:38 UTC | |
by Lawliet (Curate) on Jul 23, 2008 at 00:46 UTC | |
|
Re: returning matched word from string
by leocharre (Priest) on Jul 23, 2008 at 02:12 UTC | |
by AltBlue (Chaplain) on Jul 23, 2008 at 13:56 UTC |