Jeff Pan <[EMAIL PROTECTED]> asked:
> Is this feasible?
>
> while(<>)
> {
> next unless /$host/;
> $_=~/\((\w+)\,(\d+)\)\s+\((\w+)\,(\d+)\)/;
> my @array=("$1","$2","$3","$4");
The quotes around the variables are in fact slowing your code down -
you're forcing a string interpolation where it is not needed.
In fact, you don't need to access them at all if you write
if( my( @array ) = ( m/\((\w+)\,(\d+)\)\s+\((\w+)\,(\d+)\)/ ) ){
}
The "if" is necessary because @array will be empty if the match fails.
> }
HTH,
Thomas
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>