sravs448 has asked for the wisdom of the Perl Monks concerning the following question:
The output stored in @xlinks looks like this in mac/linuxuse 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; }
</code> The output stored in @xlinks looks like this in windowsincl -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.incl -s streamname \.\abc/def xlink /./abc/def from streamname incl -s streamname \.\xyz/qwen/defs/asd xlink /./xyzz/qwen/defs/asd from streamname
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?@xlinkpaths = ( "abc/def\", "xyzz/qwen/defs/asd\", );
|
|---|