note
DamnDirtyApe
<p>I'll leave the analysis of what you've got to someone who's better at regexps than I, but if you're simply looking to extract the argument from a space-delimited string that ends in "makefile", try something simpler like this:</p>
<code>
#! /usr/bin/perl -w
use strict;
my $old_str = 'make -r -f ..\../tools/cell/makefile cell.lib';
my $new_str = ( $old_str =~ /\s+(\S*makefile)/ )[0];
print "New string: $new_str$/";
__END__
</code>
<p>HTH</p>
<p><b>Update:</b> You could do this with <tt>split</tt> and <tt>grep</tt> also:</p>
<code>
my $new_str = ( grep { /makefile$/ } split /\s+/, $old_str )[0];
</code>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-102902">
<BR/>_______________<BR/>
[DamnDirtyApe]
<blockquote>
<pre>Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
--Friedrich Nietzsche</pre>
</blockquote>
</div></div>
418363
418363