I have the following code
use strict;
use warnings;
my( $xlink,@xlinkpaths );
my @xlinks = (`cmd to get xlinks`) ;
my $op="/";
foreach $xlink (@xlinks) {
$xlink =~ m{incl -s DS_Dalmore_Int /. /|\\.\\(.+)};
push @xlinkpaths, $1 . $op;
}
The output stored in
@xlinks looks like this in mac/linux
incl -s streamname /./abc/def
xlink /./abc/def from streamname
incl -s streamname /./xyz/qwen/defs/asd
xlink /./xyzz/qwen/defs/asd from streamname
</code>
The output stored in
@xlinks looks like this in windows
incl -s streamname \.\abc/def
xlink /./abc/def from streamname
incl -s streamname \.\xyz/qwen/defs/asd
xlink /./xyzz/qwen/defs/asd from streamname
So my final array looks like this in mac/linux, which looks good.
@xlinkpaths = (
"abc/def/",
"xyzz/qwen/defs/asd/",
);
But the output in windows shows like
@xlinkpaths = (
"abc/def\",
"xyzz/qwen/defs/asd\",
);
How can I append
\ or
/ in my
$op differently to my final array
@xlinkpaths based on windows or linux?