in reply to backward split

Anonymous Monk,
Please forgive the poor error checking as this is intended only as an idea of how to accomplish this. It seems that you would want to make this a general (any string, any character to split on, any number of items) re-usable solution, so I offer the following:
#!/usr/bin/perl -w use strict; my $string = "foo.bar.foobar"; my @array = rev_split($string, '.', 2); print "$_\n" foreach (@array); sub rev_split { return 0 unless (@_ > 1); my ($string , $split , $quantity) = @_; $string = reverse($string); $split =~ /^(.)/; $split = quotemeta $split; my @things = $quantity ? split /$split/ , $string , $quantity : spl +it /$split/ , $string; $_ = reverse($_) foreach(@things); return @things; }

Cheers - L~R

Update: I misread and assumed the split should be done first, not the reverse and I have modified code to work as desired.

Update 2: I realized this isn't as a general solution as I thought since it will only work if the split criteria is a single character. I would be interested in someone coming up with an all purpose reverse split.