in reply to How to include a doublequoted string into a backticked expression?
perlop says that backticks behave like double-quoted strings, so they interpolate. You can try first building the string and then running it, that way it's easier to debug:
my $cmd = qq{egrep -m 1 "^$lemma:" /home/lexicon}; warn "Running [$cmd]"; my $lexical_entry = `$cmd`;
... but you could also just use Perl instead of egrep:
... my $filename = '/home/lexicon'; open my $fh, '<', $filename or die "Couldn't open '$filename': $!"; while (<$fh>) { return $_ if /^$lemma:/; }; ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to include a doublequoted string into a backticked expression?
by massa (Hermit) on Jan 23, 2009 at 13:40 UTC | |
|
Re^2: How to include a doublequoted string into a backticked expression?
by pat_mc (Pilgrim) on Jan 23, 2009 at 12:18 UTC | |
by puudeli (Pilgrim) on Jan 23, 2009 at 12:48 UTC | |
by Corion (Patriarch) on Jan 23, 2009 at 12:21 UTC | |
by pat_mc (Pilgrim) on Jan 23, 2009 at 12:44 UTC | |
by Corion (Patriarch) on Jan 23, 2009 at 12:48 UTC | |
by pat_mc (Pilgrim) on Jan 23, 2009 at 13:06 UTC |