Classic-Perl
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Classic/Perl.pm view on Meta::CPAN
split //, "smat";
print join " ", @_; # prints "s m a t"
no Classic::Perl;
@_ = ();
split //, "smat";
print join " ", @_;
# prints "s m a t" in perl 5.10.x; nothing in 5.12
use Classic::Perl '$[';
$[ = 1;
print qw(a b c d)[2]; # prints "b"
use Classic::Perl '$*';
$* = 1;
print "yes\n" if "foo\nbar" =~ /^bar/; # prints yes
=head1 DESCRIPTION
Classic::Perl restores some Perl features that have been deleted in the
latest versions. By 'classic' we mean as of perl 5.8.x.
t/arybase.t view on Meta::CPAN
use Test::More tests => 24;
is(qw(a b c d e f)[4], "e");
is(substr("abcdef", 4, 1), "e");
use Classic::Perl qw($[);
is(qw(a b c d e f)[4], "e");
is(substr("abcdef", 4, 1), "e");
$[ = 2;
is(qw(a b c d e f)[4], "c");
is(substr("abcdef", 4, 1), "c");
{
local $[ = 3;
is(qw(a b c d e f)[4], "b");
is(substr("abcdef", 4, 1), "b");
}
is(qw(a b c d e f)[4], "c");
is(substr("abcdef", 4, 1), "c");
{
local $[ = 1;
is(qw(a b c d e f)[4], "d");
is(substr("abcdef", 4, 1), "d");
}
is(qw(a b c d e f)[4], "c");
is(substr("abcdef", 4, 1), "c");
{
local($[) = 1;
is(qw(a b c d e f)[4], "d");
is(substr("abcdef", 4, 1), "d");
}
is(qw(a b c d e f)[4], "c");
is(substr("abcdef", 4, 1), "c");
{
local $[ = 0;
is(qw(a b c d e f)[4], "e");
is(substr("abcdef", 4, 1), "e");
}
is(qw(a b c d e f)[4], "c");
is(substr("abcdef", 4, 1), "c");
$[ = 0;
is(qw(a b c d e f)[4], "e");
is(substr("abcdef", 4, 1), "e");
1;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.051 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )