sub get_regexp { if ($blah) $regexp = qr {}; elsif ($blahblah) $regexp = qr {}; } #### $REGEXP = get_regexp($ip); ($circuit_id) = $if_descr =~ $REGEXP;