cdaugherty82 has asked for the wisdom of the Perl Monks concerning the following question:

Having trouble with the following perl script (C:\perl\run-gpx.pl) that i've been trying to use with for 3d printing. Found script here, modified slightly for folder paths. http://www.3duniverse.org/2014/01/05/using-slic3r-with-a-flashforge-creator/

I'm getting this error: Search pattern not terminated at C:\perl\run-gpx.pl line 7.

#!/usr/bin/perl -i use strict; use warnings; use File::Basename; use Win32; my $fname = $ARGV[0]; my ($name, $path, $suffix1) = fileparse($fname, qr’\.[^\.]*'); my $shortname = "$name$suffix1"; my $shortpath = Win32::GetShortPathName($path); exec "c:/Slic3r/gpx-win32-1.3/gpx.exe" -g -p -m r1d $shortpath$shortna +me "C:/Slic3r/Output Files/$name.x3g"

Replies are listed 'Best First'.
Re: Beginner having trouble with short script
by choroba (Cardinal) on Nov 10, 2016 at 00:34 UTC
    The quote after qr seems to be a "smart" one.

    It's possible to use unicode characters as delimiters (with utf8), but Perl doesn't recognise pairs in such a case, and the behaviour of substitution depends on Perl version:

    ~$ perl5.20.1 -Mutf8 -wE 'say "abc" =~ s’b’x’r' axc ~$ perl5.18.1 -Mutf8 -wE 'say "abc" =~ s’b’x’r' Substitution replacement not terminated at -e line 1. [$?: 255] ~$ perl5.18.1 -Mutf8 -wE 'say "abc" =~ s’b’’x’r' axc

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re: Beginner having trouble with short script
by AnomalousMonk (Archbishop) on Nov 10, 2016 at 01:02 UTC