in reply to I need help with pattern matching

The cause of your output is beyond me; however, I'd suggest a different approach to aquiring the numbers:

#! /usr/bin/perl use strict ; use warnings ; # $|++ ; while ( <DATA> ) { /^Phys.*(\w)-(\w\w)-(\w\w)$/ ; my $match = 'hhh' . $1 . $2 . $3 . 'kk' ; print "The new string is: $match\n" ; last ; } __DATA__ Physical Address. . . . . . . . . : 00-B0-D0-87-52-19 DHCP Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 192.45.10.166

_______________
DamnDirtyApe
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
            --Friedrich Nietzsche

Replies are listed 'Best First'.
Re: Re: I need help with pattern matching
by kirk123 (Beadle) on Aug 15, 2002 at 22:16 UTC
    Thanks to all: I 've just solved my own problem. Forgot to put length in substr() . ---kirk