John W. Krahn wrote at Tue, 02 Jul 2002 22:51:17 +0200: > filename Rnott230602.txt > > I want to break down the name and compare with other text, it breaks down > as R / nott / 230602 (3 items) > the length does not change. > If the length is always the same you could use unpack. > > my ( $type, $name, $number ) = unpack 'a a4 a6', $filename; >
or TMTWTDI use a simple regex: my ($type, $name, $number) = $filename =~ /(.)(.{4})(.{6})/; As I'm more familiar with regexes than the thousands options of (un)pack, I'd prefer :-)) Another option is to think that the type is the starting letter, the following non digits build the name and then the number build of digits is coming. my ($type, $name, $number) = $filename =~ /(.)(\D+)(\d+)/; Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]