Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Code Block
bgColor#ccccff
langperl
my $data = 'Tom$Dick$Harry';
my @names = split( m/\$/, $data);

Exceptions

Wiki Markup*STR31-EX0*: A string literal may be passed to a function if it normally takes a regex pattern, but provides special behavior for that string. For example, the {{perlfunc}} manpage\[[Wall 2011|AA. Bibliography#Manpages] \] says, regarding {{PATTERN}}, the first argument to {{split()}}:

{quote}}
As a special case, specifying a PATTERN of space (' ') will split on white space just as "split" with no arguments does. Thus, "split(' ')" can be used to emulate awk's default behavior, whereas "split(/ /)" will give you as many initial null fields (empty string) as there are leading spaces.
{{quote}

...

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

STR31-PL

low

likely

low

P9

L2

Automated Detection

Tool

Diagnostic

Perl::Critic

BuiltinFunctions::ProhibitStringySplit

Bibliography

Wiki Markup\[[CPAN|AA. Bibliography#CPAN]\] [Elliot Shank, Perl-Critic-1.116|http://search.cpan.org/~elliotjs/ Perl-Critic-1.116/] [BuiltinFunctions::ProhibitStringySplit|http://search.cpan.org/dist/Perl-Critic/lib/Perl/Critic/Policy/Subroutines/ProhibitSubroutinePrototypes.pm] \[[Wall 2011|AA. Bibliography#Manpages]\] [perlfunc|http://perldoc.perl.org/perlfunc.html]
[Wall 2011] perlfunc

...

EXP30-PL. Do not use deprecated or obsolete functions      02. Expressions