It would be a lot more accurate to write two different expressions, one for each OS and then just have your script check which OS it is running on and use the appropriate regex.
$sunifconfig=qr/blahblahblah/; $linuxifconfig=qr/blahblahblah/; if ($^O eq "linux"){ $ifconfigoutput=~/$linuxifconfig/; } else { $ifconfigoutput=~/$sunifconfig/; }
*That code is untested.
Fellow monks, I don't know if using the $^O ($OSNAME) variable is the right way to go here. Feel free to comment.
HTH
In reply to Re: patern matching difficulties, in two cases
by pzbagel
in thread pattern matching difficulties, in two cases
by jcpunk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |