[NBLUG/talk] Another stupid Perl question....
Eric Eisenhart
eric at nblug.org
Tue Jun 7 14:44:05 PDT 2005
On Tue, Jun 07, 2005 at 02:39:15PM -0700, Eric Eisenhart wrote:
> sub get_ss( $$ ) {
> my $sub = shift;
> my $str = shift;
> if ( $str =~ m/ \Q$sub\E (.{18}) /msx ) { # indent regex if wanted
> return $1;
> } else {
> return undef; # or die? do you like exceptions?
> }
> }
Depending on what you're looking at, maybe split would work? And maybe
instead of (.{18}) you should go with (.*?)(?:$|;|") ?
--
Eric Eisenhart
NBLUG Co-Founder, Scribe and InstallFest Coordinator
The North Bay Linux Users Group -- http://nblug.org/
eric at nblug.org, IRC: Freiheit at fn AIM: falschfreiheit
More information about the talk
mailing list