Here's a breakdown of matching from the following string what you asked for:
my $line = "1111\\222222\\3333333\\hello\n44444\\last\n";
I made it slightly more challenging by adding a second possible match at the end. Now there are two words that are preceeded by a '\' and followed by a '\n', 'hello' and 'last'.
A first attempt might be:
my ($prepath1, $base1) = $line =~ /(.*\\)(.*)\n/;
# $prepath1 == '1111\222222\3333333\'
# $base1 == 'hello'
Which actually works. The '(.*\\)' greedily matches everything up to the last '\' that it finds and captures it all, along with the '\' into $1. The '(.*)' captures everything after the '\' up to a '\n' into $2. The reason that this matched the 'hello' and not the 'last' is because the wildcard '.' does not match '\n' by default. You have to use the /s modifier to get this behavior.
my ($prepath2, $base2) = $line =~ /(.*\\)(.*)\n/s;
# $prepath2 == '1111\222222\333333\hello\n44444\'
# $base == 'last'
All of the following give the same result as the first example:
my ($prepath3, $base3) = $line =~ /(.*\\)([^\\]+)\n/;
my ($prepath4, $base4) = $line =~ /(.*?\\)([^\\]+)\n/;
my ($prepath5, $base5) = $line =~ /(.*?\\)([^\\]+)\n/s;
# $prepath1 == '1111\222222\3333333\'
# $base1 == 'hello'
But now the match for 'hello' is more rigid (it must be a non-'\' character, which is what the '[^\\]+' does: one or more non-'\' chars). So even making the prepath match non-greedy (by adding a '?' after the '.*') doesn't make a difference. Compare this to making the first example non-greedy:
my ($prepath6, $base6) = $line =~ /(.*?\\)(.*)\n/;
# $prepath6 == '1111\'
# $base6 == '222222\3333333\hello'
Now the '(.*?\\)' only matches up to the FIRST '\' that it finds and the '(.*)' captures the rest up to the newline.
That's probably more than you really wanted.
jaa