perl::critic::policy::variables::prohibitmatchvars(3pm) [debian man page]
Perl::Critic::Policy::Variables::ProhibitMatchVars(3pm) User Contributed Perl DocumentationPerl::Critic::Policy::Variables::ProhibitMatchVars(3pm)NAME
Perl::Critic::Policy::Variables::ProhibitMatchVars - Avoid "$`", "$&", "$'" and their English equivalents.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Using the "match variables" "$`", $&, and/or "$'" can significantly degrade the performance of a program. This policy forbids using them
or their English equivalents. See perldoc English or PBP page 82 for more information.
It used to forbid plain "use English;" because it ends up causing the performance side-effects of the match variables. However, the
message emitted for that situation was not at all clear and there is now Perl::Critic::Policy::Modules::RequireNoMatchVarsWithUseEnglish,
which addresses this situation directly.
CONFIGURATION
This Policy is not configurable except for the standard options.
AUTHOR
Chris Dolan <cdolan@cpan.org>
COPYRIGHT
Copyright (c) 2006-2011 Chris Dolan.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.14.2 2012-06-07 Perl::Critic::Policy::Variables::ProhibitMatchVars(3pm)
Check Out this Related Man Page
Perl::Critic::Policy::Variables::RequireNegativeIndices(User Contributed Perl DocumentPerl::Critic::Policy::Variables::RequireNegativeIndices(3pm)NAME
Perl::Critic::Policy::Variables::RequireNegativeIndices - Negative array index should be used.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Conway points out that
$arr[$#arr];
$arr[$#arr-1];
$arr[@arr-1];
$arr[@arr-2];
are equivalent to
$arr[-1];
$arr[-2];
$arr[-1];
$arr[-2];
and the latter are more readable, performant and maintainable. The latter is because the programmer no longer needs to keep two variable
names matched.
This policy notices all of the simple forms of the above problem, but does not recognize any of these more complex examples:
$some->[$data_structure]->[$#{$some->[$data_structure]} -1];
my $ref = @arr;
$ref->[$#arr];
CONFIGURATION
This Policy is not configurable except for the standard options.
AUTHOR
Chris Dolan <cdolan@cpan.org>
COPYRIGHT
Copyright (c) 2006-2011 Chris Dolan.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-06-07 Perl::Critic::Policy::Variables::RequireNegativeIndices(3pm)
I am not a native English speaker. I wanna improve my English. But I am kind of lazy, so I decide to pratice my English by reading English novel. I'd like read books about magic or superman and so on. How can I get that kind of books from Internet? I'll really appreciate it!! (4 Replies)
Hi.
I have three arrays.
@a=('AB','CD','EF');
@b=('AB,'DG',HK');
@c=('DD','TT','MM');
I want to compare the elements of the first two array and if they match then so some substition.
I tried using the if statement using the scalar value of the array but its not giving me any output.
... (7 Replies)
Hi All
Trying to get a better handle on variables. ie how $1, $2, $3... are used. I have tried searching this site without much luck. When it would be used in how is $1 used in a program? I know you can asign variables x=4, just do not understand $1, $2.
Thanks, Doug (1 Reply)
Hi All,
UPDATE: This has been cancelled. No more Event Prediction.
Place your bits here before 30th March 2014.
Who will be crowned English Premier League champions for the 2013-14 Season
Tottenham Hotspur
Manchester City
Chelsea
Liverpool
Arsenal
Everton
Manchester United... (0 Replies)