Skip to content

Instantly share code, notes, and snippets.

@tobyink
Created March 3, 2020 08:19
Show Gist options
  • Select an option

  • Save tobyink/3b97afc11feaddffef4969a61676a324 to your computer and use it in GitHub Desktop.

Select an option

Save tobyink/3b97afc11feaddffef4969a61676a324 to your computer and use it in GitHub Desktop.
splitting on last occurance
use strict;
use warnings;
use feature 'say';
my $input = 'foo:bar:baz:quux';
my ($fbb, $quux) =
reverse map scalar(reverse($_)),
split /:/, reverse($input), 2;
say $fbb;
say $quux;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment