Well, that does tell us that you're not chomping the input, which you should be doing. chomp @array; would take care of that problem. What it doesn't show me is how the following would fail:
my @array = (
'sn ThisUser',
'mail: ThisUser@somewhere.com',
'cn: This User',
'uid: MyUID',
);
foreach my $line ( @array ) {
if( $line =~ m/^mail:\s+([\S]+)/ ) {
print "$1\n";
}
}
It doesn't fail on my system, which leads me to believe that the problem is in a portion of your code that we're not seeing, or in your data-set. If your data-set looks clean, we're back to the portion of the code that we haven't been shown.
|