in reply to where is /\d+$/ result??
Or, if you were interested in Perl Golf, you might tryif ($frameDesc =~ /(\d+)$/ ) { print FH "FTP $1\n"; } else { print FH "FTP 0\n"; }
my $value = ($frameDesc =~ /(\d+)$/ ) ? $1 : 0; print FH "FTP $value\n";
If you had two sets of parentheses in your regex and you wanted to manipulate the second value, you'd specify $2, etc.
Warning: the code is untested.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: where is /\d+$/ result??
by ww (Archbishop) on May 04, 2008 at 03:17 UTC | |
|
Re^2: where is /\d+$/ result??
by ikegami (Patriarch) on May 04, 2008 at 01:38 UTC |