Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: replacing equal to operator

by Fletch (Bishop)
on Jan 28, 2021 at 18:44 UTC ( [id://11127587]=note: print w/replies, xml ) Need Help??


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;

    🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11127587]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-03-28 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found