Foggy Bottoms has asked for the wisdom of the Perl Monks concerning the following question:
How can I reduce the 2 ifs to a one-liner ? Thanks for your insight...if ($content =~ /^(sub\s+\w+).+$/) { print "$1.\n"; # print sub name if ($content =~ /(#.+)$/) { print "$1\n"; # print sub comment } }
20030827 Edit by jeffa: Changed title from 'regular expression help '
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Automatic documentation stubs for .pl source
by halley (Prior) on Aug 26, 2003 at 15:33 UTC | |
|
Re: Automatic documentation stubs for .pl source
by Abigail-II (Bishop) on Aug 26, 2003 at 15:32 UTC | |
|
Re: Automatic documentation stubs for .pl source
by Fletch (Bishop) on Aug 26, 2003 at 15:25 UTC | |
|
Re: Automatic documentation stubs for .pl source
by CombatSquirrel (Hermit) on Aug 26, 2003 at 15:38 UTC | |
|
Re: Automatic documentation stubs for .pl source
by davido (Cardinal) on Aug 26, 2003 at 17:00 UTC | |
|
Re: Automatic documentation stubs for .pl source
by BrowserUk (Patriarch) on Aug 26, 2003 at 23:53 UTC |