Perl Forum for Beginners

Strict subs" in use at -e line 1.

Mar 6, 2012 3:31 pm
Lina

$ perl -Mstrict -wle '{my $char = chr(Ox394) ; print $char;}'

Bareword "Ox394" not allowed while "strict subs" in use at -e line 1.
Execution of -e aborted due to compilation errors.

I don't understand the above error message well,

Thanks ahead for any explainations,

Best Regards,

Mar 6, 2012 3:45 pm
Shawn H Corey
Re: strict subs" in use at -e line 1.

On 12-03-06 10:31 AM, lina wrote:
> $ perl -Mstrict -wle '{my $char = chr(Ox394) ; print $char;}'
>
> Bareword "Ox394" not allowed while "strict subs" in use at -e line 1.
> Execution of -e aborted due to compilation errors.
>
> I don't understand the above error message well,
>
> Thanks ahead for any explainations,
>
> Best Regards,
>

First time I tried it, I got the same error. But after goofing around a
bit, it started to work.

$ perl -Mstrict -wle '{my $char = chr(Ox394) ; print $char;}'
Bareword "Ox394" not allowed while "strict subs" in use at -e line 1.
Execution of -e aborted due to compilation errors.
$ perl -Mstrict -wle '{my $char = chr(Ox94) ; print $char;}'
Bareword "Ox94" not allowed while "strict subs" in use at -e line 1.
Execution of -e aborted due to compilation errors.
$ perl -Mstrict -wle '{my $char = chr(Ox4) ; print $char;}'
Bareword "Ox4" not allowed while "strict subs" in use at -e line 1.
Execution of -e aborted due to compilation errors.
$ perl -Mstrict -wle '{my $char = chr(394) ; print $char;}'
Wide character in print at -e line 1.
?
$ perl -Mstrict -wle '{my $char = chr(0394) ; print $char;}'
Illegal octal digit '9' at -e line 1, at end of line
Execution of -e aborted due to compilation errors.
$ perl -Mstrict -wle '{my $char = chr(034) ; print $char;}'

$ perl -Mstrict -wle '{my $char = chr(044) ; print $char;}'
$
$ perl -e'print 0x34'
52$ perl -e'print chr(0x34)'
4$ perl -e'$char=chr(0x34)'
$ perl -e'$char=chr(0x34);print $char'
4$ perl -e'my$char=chr(0x34);print $char'
4$ perl Mstrict -wle '{my $char = chr(0x30) ; print $char;}'
0
$ perl -Mstrict -wle '{my $char = chr(0x394) ; print $char;}'
Wide character in print at -e line 1.
?
$


Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
It's Mutual Aid, not fierce competition, that's the dominate
force of evolution. Of course, anyone who has worked in
open source already knows this.
Mar 6, 2012 3:47 pm
Chris Stinemetz
Re: strict subs" in use at -e line 1.

On Tue, Mar 6, 2012 at 9:31 AM, lina <lina.lastname@gmail.com> wrote:
> $ perl -Mstrict -wle '{my $char = chr(Ox394) ; print $char;}'
>
> Bareword "Ox394" not allowed while "strict subs" in use at -e line 1.
> Execution of -e aborted due to compilation errors.
>
> I don't understand the above error message well,
>
> Thanks ahead for any explainations,
>
> Best Regards,
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>

If you are simply trying to assign "chr(0x394)" to varible $char and
then print $char then the below will work.

perl -Mstrict -wle '{my $char = "chr(0x394)" ; print $char;}'


HTH,

Chris


Mar 6, 2012 3:54 pm
Lina
Re: strict subs" in use at -e line 1.

On Tue, Mar 6, 2012 at 11:42 PM, Paul Johnson <paul@pjcj.net> wrote:
> On Tue, Mar 06, 2012 at 11:31:59PM +0800, lina wrote:
>> $ perl -Mstrict -wle '{my $char = chr(Ox394) ; print $char;}'
>>
>> Bareword "Ox394" not allowed while "strict subs" in use at -e line 1.
>> Execution of -e aborted due to compilation errors.
>>
>> I don't understand the above error message well,
>
> The immediate problem you are seeing is that you should be using the
> number zero (0) rather than the uppercase letter O (O).

Thanks, I have never tried the hexadecimal output before. I thought ...

why is 0, not O?

>
> If you are not using a font which allows you to easily distinguish
> between then two, may I suggest inconsolata as a good choice for

I can easily tell the two, I just read from pdf and took it as O,
just googled the inconsolata, I will stick to the gvim

Thanks again,
> programming?
>
> --
> Paul Johnson - paul@pjcj.net
> http://www.pjcj.net




Previous Thread: Read and write
Next Thread: Problem with nested regex matchs

Related Forum Topics
Bareword and strict subs
On 12-05-31 06:28 PM, Mark Haney wrote:
> sub insert_shift {
> my $self = shift;
> my $attrs = @_;

Should this be:
my %attrs = @_;

>
> my $m = $self->schema->resultset('Shifts')->new(attrs);

my $m = $self->schema->resultset('Shifts')->new(%attrs);

>...
Bareword "Google::Adwords::Campaign" not allowed while "strict subs" in use
I'm trying to use the Google::Adwords perl modules but I'm getting:

Bareword "Google::Adwords::Campaign" not allowed while "strict subs" in use

Here is the beginning of my script:

use Google::Adwords::Campaign;
use Google::Adwords::CampaignService;
sub {
my $campaign =...
How to resolve this Unparsable version '' for prerequisiteTest::Strict at Makefile.PL line 563
Dear All,

I am new to perl, I am facing a problem
while installing koha LMS software. When O run the Makefile.pl it shows
the below error:
Unparsable version '' for prerequisite Test::Strict at Makefile.PL line 563

What is Unparsable version of Test::Strict? is it mean that I am...
Can't use string ("1") as a HASH ref while "strict refs" in use at./policy.sanitizer line 255.
Hi there,

I am trying to figure out why the following lines are giving me an error:


--- snip ---

$found{filter}{$filter}{family}{$family} = 1;
print keys %{ $found{filter}{$filter}{family} };


--- snip ----

here's the error

Can't use string ("1") as...
Undefined subroutine &main::subs
Hi,

$ ./substr_accessing_examples.pl
Undefined subroutine &main::subst called at
./substr_accessing_examples.pl line 15.

#!/usr/bin/env perl

use strict;
use warnings;

#
# get a 5-byte string, skip 3 bytes,
# then grab two 8-byte strings, then the rest;
#

# (my $leading, my...
Concerning passing refs of anonyme Hash to subs...
------=_Part_15306_876998964.1223634587301
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi there,

have a look at this example:
########################################################
#!/usr/local/bin/perl
use strict;
use...
Something about "strict"
Hi,

#!/usr/bin/perl

use strict;
use warnings;

sub add
{
$results = $_[0] + $_[1];
print "The result was: $results\n";
}

add(1,2)

$ ./subroutines_examples.pl
Global symbol "$results" requires explicit package name at
./subroutines_examples.pl line 8.
Global symbol...
Use Strict and using module
Hello,

Purpose:
I am trying to understand the reason for the following error.

Error:
"Bareword "NetCDF::READ" not allowed while "strict subs" in use..."

Actions already taken:
1. Searched Google --> Perl Bareword not allowed while "strict subs"
Most of the hits I have looked at deal...
Use strict / nostrict
>> #!/usr/bin/perl
>> use Text::CSV;
>> use DBI;
>> use Data::Dumper;
>
> There is no "use strict;" and "use warnings;" at the beginning of the file:

I see this quite a bit on this list (and elsewhere) and I think it's very good advice, so this morning I got to thinking. If these...
No more strict deadlines
---923142335-1510017444-1323099069=:45499
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<p>hey there.<br>I knew it was important for me to stay optimistic this cau=
ght my attention now I know money is power you are definitely cut out for t=
his<br><a...