http://qs321.pair.com?node_id=11127587


in reply to replacing equal to operator

You're overcomplicating things perhaps . . .

$ perl -E '$_=qq{parameter=TO_DATE('1900-01-01','YYYY-MM-DD')\n};print + qq{Before: $_};s{=(.*)$}{="$1"};print qq{ After: $_}' Before: parameter=TO_DATE(1900-01-01,YYYY-MM-DD) After: parameter="TO_DATE(1900-01-01,YYYY-MM-DD)"

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: replacing equal to operator
by hippo (Bishop) on Jan 28, 2021 at 19:01 UTC

    I came up with the same approach but you don't even need that $ because the dot doesn't match the newline by default.

    use strict; use warnings; use Test::More tests => 1; my $have = qq#parameter=TO_DATE('1900-01-01','YYYY-MM-DD')\n#; my $want = qq#parameter="TO_DATE('1900-01-01','YYYY-MM-DD')"\n#; $have =~ s/=(.*)/="$1"/; is $have, $want;

    🦛