Perl Gem, Filehandle Quoting


Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/cache/MessageCache.php on line 731

Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/cache/MessageCache.php on line 739

Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/parser/Preprocessor_DOM.php on line 754

Deprecated: Constant E_STRICT is deprecated since 8.4, the error level was removed in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/GlobalFunctions.php on line 2409
From Bilbo

Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/cache/MessageCache.php on line 731

Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/cache/MessageCache.php on line 739
Jump to:
Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/cache/MessageCache.php on line 731

Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/cache/MessageCache.php on line 739
navigation

Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/cache/MessageCache.php on line 731

Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/cache/MessageCache.php on line 739

Deprecated: Constant E_STRICT is deprecated since 8.4, the error level was removed in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/GlobalFunctions.php on line 2409

Deprecated: Constant E_STRICT is deprecated since 8.4, the error level was removed in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/GlobalFunctions.php on line 2409
,
Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/cache/MessageCache.php on line 731

Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in /project/www/bilbo.hobbiton.org/mediawiki-1.23.8/includes/cache/MessageCache.php on line 739
search

2006-07-21

This Perl code actually does not emit any warnings or errors!

#!/usr/bin/perl
use strict;
use warnings;
</table>

On further investigation, this code ...

#!/usr/bin/perl

use strict;
use warnings;

my @q = </table asdf>;

print "Length:  ", scalar(@q), "\n";
print "$_\n" foreach @q;

... generates this output ...

Length:  2
/table
asdf

Go figure.

While the notation <table> would emit an error (because the filehandle named "table" isn't open and thus can't be read from), if the junk inside the brackets is not a single bareword, Perl treats it more like qw-quoting, where it separates the inside on spaces and returns it as a list of strings. There Are Too Many Ways To Do It.