Jerry Preston wrote:
> 
> Hi!

Hello,

> I am getting no where on this and it is not that hard.
> I am trying to break down the following:
> 
> D-2165033-10.TKB61a
> 
> into
> 
> D   2165033   10
> 
> and
> 
> 4-2175587-08.TKB63a
> 
> into
> 4   2175587  08
> 
> using
> 
> (( $ref, $numt, $id, $ext ) = $PATH[ 7 ] ) =~
> /\w-(\d{7})-(\d{2}).[\w+|\d+]/;
> 
> What am I doing wring?

You need parentheses around the \w character class at the beginning and
the character class at the end.  The character class [\w+|\d+] matches a
_single_ character that is either \w (A-Za-z0-9_) or a plus sign (+) or
a vertical bar (|) or \d (0-9) or a plus sign (+).  Since you probably
don't want to match a plus sign or a vertical bar you shouldn't include
them in the character class.  Since the \w character class includes the
\d character class there is no reason to use them both in the same
character class.

my ( $ref, $numt, $id, $ext ) = $PATH[ 7 ] =~
/(\w)-(\d{7})-(\d{2}).(\w+)/;

Or you could do it this way:

my ( $ref, $numt, $id, $ext ) = split /[-.]/, $PATH[ 7 ];



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to