Created
March 3, 2020 08:19
-
-
Save tobyink/3b97afc11feaddffef4969a61676a324 to your computer and use it in GitHub Desktop.
splitting on last occurance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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