in reply to Regex not behaving as expected

context. your example has $sk in scalar context. you need list context, i.e. ($sk)

perl -e'$_=q#: 13_2: 12/"{>: 8_4) (_4: 6/2"-2; 3;-2"\2: 5/7\_/\7: 12m m::#;s#:#\n#g;s#(\D)(\d+)#$1x$2#ge;print'

Replies are listed 'Best First'.
Re: Re: Regex not behaving as expected
by pizza_milkshake (Monk) on Feb 01, 2003 at 12:21 UTC

      Not necessarily. If there are no capture groups then the list context result behaves as if there is an implicit group around the entire regex.


      Seeking Green geeks in Minnesota

        Iff there is a /g modifier on it.