in reply to Bareword found error on MacOS
Seems to work fine for me on a mac running 5.16.0
And gives me:#!/usr/bin/perl # bareword.pl use strict; use warnings; my $select="this isn't a'regular 'expression"; print $select."\n"; my $stripped = $select =~ s/ ( ' .*? ' ) /'_' x length $1/egrx; print $stripped."\n"; print $1."\n"; print $select."\n";
this isn't a'regular 'expression this isn_____regular 'expression 't a' this isn't a'regular 'expression
Edit Also works fine under 5.14.2
Another Edit Are you sure you're running the right perl version on the mac? If it's picking the perl from the shebang then you could be using the system perl, where you want to use different one (e.g. installed via perlbrew). In my two tests above I ran it with perl bareword.pl so it would use the perlbrew versions. If I run it with ./bareword.pl it uses the system install of 5.12.3 and I get your bareword error.
|
---|
In Section
Seekers of Perl Wisdom