in reply to Perl appending \ or / based on windows or linux

Hi,

probably with something like that:

my %seperators = ( 'Linux' => '/', 'MSWin32' => '\\', 'MacOS' => '/', ); my $op = quotemeta($seperators{$^O} || '/');

Regards
McA

Replies are listed 'Best First'.
Re^2: Perl appending \ or / based on windows or linux
by Anonymous Monk on Oct 07, 2014 at 18:50 UTC

    That's

    my %separators = ( linux => '/', MSWin32 => '\\', darwin => '/', );

    There's other possible values, but the script could be restricted to run on only the "supported" platforms via

    die "This script doesn't yet run on $^O\n" unless $separators{$^O};