in reply to How to set a delimiter. (Moved from Q&A)
You were on the right track... but the square brackets puzzle me.if ($info =~ /(hi|lo)\s+(\d{1,3}).F/i) { # do something with $1 and $2 }
Update: jlp suggests that temperatures may be negative, in which case it makes lots of sense. Here's the revision to allow that:
The ? means the hyphen may or may not be present. If it is, it will be grouped with the digits and stored in $2.if ($info =~ /(hi|lo)\s+(-?\d{1,3}).F/i) { # do something with $1 and $2 }
|
|---|