kepler has asked for the wisdom of the Perl Monks concerning the following question:
The problem is that I'm getting duplicated items in the hash. And, that can be more expressions in one line - but probably not... Can anyone help me out here? Kind regards, Keplersub Grab($filename){ open (file1, "<$filename") or goto cont2; while (<file1>){ my($line) = $_; my ($exp) = $line =~ m/ kepler_ # Required (.+?) # Capture Desired Output (:?\s\(|\(|\s+) # One required - no capture /xi; $expr = "kepler_".$1; if(@Functions =~ /$expr/gi){goto cont1;} if($1 =~ ""){goto cont1;} $n += 1; print $expr."\n"; $value1 = "Exp_".$n; $key1 = $expr; $functions{ $key1 } = $value1; # hash, using variables cont1: } cont2: close file1; } #END GRAB
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Catching expressions from a file
by RonW (Parson) on Jul 25, 2014 at 23:16 UTC | |
by GrandFather (Saint) on Jul 26, 2014 at 02:33 UTC | |
|
Re: Catching expressions from a file
by AnomalousMonk (Archbishop) on Jul 26, 2014 at 01:06 UTC | |
by Anonymous Monk on Jul 26, 2014 at 07:56 UTC | |
|
Re: Catching expressions from a file
by Anonymous Monk on Jul 25, 2014 at 21:48 UTC | |
|
Re: Catching expressions from a file
by AppleFritter (Vicar) on Jul 25, 2014 at 22:13 UTC | |
by kepler (Scribe) on Jul 25, 2014 at 22:22 UTC |