in reply to Appending values to variable.

I strongly suggest using either File::Spec or it's nicer wrapper Path::Class for manipulating file paths in a portable way. You'll save yourself a lot of headaches.

use Path::Class; my $file = file($filepath,"test.txt");

Doing it the hard way, you can recombine a split using join. Alternatively, you could change the slashes using a regex substitution and then append as normal.

$filepath =~ s{/}{\}g; $file = $filepath . "\test.txt";

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.