in reply to Re: split command
in thread split command

Thank you!

Replies are listed 'Best First'.
Re^3: split command
by ikegami (Patriarch) on Feb 21, 2007 at 18:51 UTC

    or

    my ($key, $val) = 'MYKEY=MYVAL=2' =~ /^([^=]*)=(.*)/s;
      or perhaps

      my ($key, $val) = split m{=(?=.*=)}, q{MYKEY=MYVAL=2};

      Cheers,

      JohnGG

        What would be the benefit?

        • It makes needless and baseless assumption about the data format (that there will always be exactly two equal signs, no more, no less).
        • It's less readable and/or maintainable than the previously posted solutions.
        • It's probably slower than the previously posted solutions.