Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

perl::critic::policy::builtinfunctions::prohibitstringysplit(3pm) [debian man page]

Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySUser(Contributed Perl DocPerl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit(3pm)

NAME
Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit - Write "split /-/, $string" instead of "split '-', $string". AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
The "split" function always interprets the PATTERN argument as a regular expression, even if you specify it as a string. This causes much confusion if the string contains regex metacharacters. So for clarity, always express the PATTERN argument as a regex. $string = 'Fred|Barney'; @names = split '|', $string; #not ok, is ('F', 'r', 'e', 'd', '|', 'B', 'a' ...) @names = split m/[|]/, $string; #ok, is ('Fred', Barney') When the PATTERN is a single space the "split" function has special behavior, so Perl::Critic forgives that usage. See "perldoc -f split" for more information. CONFIGURATION
This Policy is not configurable except for the standard options. SEE ALSO
Perl::Critic::Policy::ControlStrucutres::RequireBlockGrep Perl::Critic::Policy::ControlStrucutres::RequireBlockMap AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved. 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::BuiltinFunctions::ProhibitStringySplit(3pm)

Check Out this Related Man Page

Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySUser(Contributed Perl DocumPerl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit(3)

NAME
Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit - Write "split /-/, $string" instead of "split '-', $string". AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
The "split" function always interprets the PATTERN argument as a regular expression, even if you specify it as a string. This causes much confusion if the string contains regex metacharacters. So for clarity, always express the PATTERN argument as a regex. $string = 'Fred|Barney'; @names = split '|', $string; #not ok, is ('F', 'r', 'e', 'd', '|', 'B', 'a' ...) @names = split m/[|]/, $string; #ok, is ('Fred', Barney') When the PATTERN is a single space the "split" function has special behavior, so Perl::Critic forgives that usage. See "perldoc -f split" for more information. CONFIGURATION
This Policy is not configurable except for the standard options. SEE ALSO
Perl::Critic::Policy::ControlStrucutres::RequireBlockGrep Perl::Critic::Policy::ControlStrucutres::RequireBlockMap AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved. 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.16.3 2014-06-09 Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit(3)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

perl split funciton - special character "/"

HI, I have a directory structure. /abc/def/ghi/ I want to store it into array. So that if I do a pop function on that array I can easily go to previous directory. But how can i split and store it. @Directory = split(/\//,$DirectoryVarialbe) That doest works. Any other escape sequence... (5 Replies)
Discussion started by: deepakwins
5 Replies

2. Shell Programming and Scripting

Use split function in perl

Hello, if i have file like this: 010000890306932455804 05306977653873 0520080417010520ISMS SMT ZZZZZZZZZZZZZOC30693599000 30971360000 ZZZZZZZZZZZZZZZZZZZZ202011302942311 010000890306946317387 05306977313623 0520080417010520ISMS SMT ZZZZZZZZZZZZZOC306942190000 30971360000... (5 Replies)
Discussion started by: chriss_58
5 Replies

3. Shell Programming and Scripting

q with Perl Regex

For a programming exercise, I am mean to design a Perl script that detects double letters in a text file. I tried the following expressions # Check for any double letter within the alphabet /+/ # Check for any repetition of an alphanumeric character /\w+/ Im aware that the... (8 Replies)
Discussion started by: JamesGoh
8 Replies

4. Shell Programming and Scripting

split the string

I need to split the string msu1_2 It should be generic for any string of the form msu<digits>_<digits> so that i get $X =1 and $Y = 2 Please help Thanks (5 Replies)
Discussion started by: asth
5 Replies

5. Shell Programming and Scripting

Perl split question

hi, I have a seemingly really stupid question, but here goes! What do you enter into split delimiter to seperate something like this "December 12, 1995" and get December 12 1995 ? thanks (5 Replies)
Discussion started by: ade214
5 Replies

6. Shell Programming and Scripting

How to split a text after fix character count

HI, I want to split a text after certain fix character count in text. For eg: My file is containing text like: AURBJR,AURCID,AURVID,CHANDV,DAMNEW,DHMMAN,GANGAN,GARKHE,GOREGA,JEJKHA,JEJSHI,JINTUR,JMKKUS,JUNAWA,KALKAL,KHOJEW,KUNJIR,MAGARP,MAHAD, in this i want to print text after each... (5 Replies)
Discussion started by: vikash.rastogi
5 Replies

7. Shell Programming and Scripting

Perl REGEX

Hi, Can anyone help me to find regular expression for the following in Perl? "The string can only contain lower case letters (a-z) and no more than one of any letter." For example: "table" is accepted, whether "dude" is not. I have coded like this: $str = "table"; if ($str =~ m/\b()\b/) {... (4 Replies)
Discussion started by: evilfreakz
4 Replies

8. Shell Programming and Scripting

Perl use split and remove specific character

i want to split the input by a space and remove specific characters like full stop, comma...... etc. and then save each word in an array. i got something below, but it didn't work. can anyone please help me? Thank you #!/usr/bin/perl -w while (<>) { $line = <>; @word = split(' ',... (6 Replies)
Discussion started by: mingming88
6 Replies

9. Shell Programming and Scripting

Unix Perl split special character $

All I'm trying to split a string at the $ into arrays @data:=<dataFile> a $3.33 b $4.44 dfg $0.56 The split command I have been playing with is: split(/\$/, @data) which results with a .33 b .44 dfg .56 any help with this is appreciated /r Rick (9 Replies)
Discussion started by: schultz2146
9 Replies

10. Shell Programming and Scripting

split string using separetor

i have one string , I want to split that string. exmp: string="abc@hotmail.com;xyz@gmail.com;uvw@yahoo.com" I want to split it and save it in three variable str1=abc@hotmail.com str2=xyz@gmail.com str3=uvw@yahoo.com I want to split using ';'. please help. (10 Replies)
Discussion started by: rinku
10 Replies

11. UNIX for Dummies Questions & Answers

Reading one line from a multiline string

Hi , I have a string which is of multiple line,I have to split the string by reading one line in each iteration and keep it in a string.I am keeping all the file names in side as string returned by the ls command ,I am stocked at the point of spliting the string to segragate each file. ... (4 Replies)
Discussion started by: Deekay.p
4 Replies

12. UNIX for Advanced & Expert Users

regular expression for split function in perl

Hi, Below is an example of a record I have, which I wish to split using the perl's split function and load it into an array. I am having tough time figuring out the exact reg-ex to perform the split. Given record: "a","xyz",0,2,48,"abcd","lmno,pqrR, stv",300,"abc",20, The delimiter to... (4 Replies)
Discussion started by: jghoshal
4 Replies

13. UNIX for Dummies Questions & Answers

Splitting a file in a directory!

Hey guys! So I have a directory with 82 genomes in it and I have to split them up, one by one, into genes. I tried using the split function, like #!/usr/bin/perl use strict; use warnings; my $data = 'location'; my @values = split('>', $data); foreach my $val... (9 Replies)
Discussion started by: PerlNutt
9 Replies

14. Shell Programming and Scripting

How to check line existence in shell ?

Hi, We have some config file and there we are looking to append a line if it is not found. abc.conf authpriv.* /var/log/secure mail.* -/var/log/maillog *.debug @vxhgt-hskhng02 cron.* ... (12 Replies)
Discussion started by: Litu19
12 Replies

15. Shell Programming and Scripting

[Perl] split on : but with extra challenge

Hi, I am looking for a little bit more advanced split. Code: #!/usr/bin/perl -w #-d use strict; my $Line = "value1:{value2a:value2b}:value3:{}:value5:{value6a:value6b}"; my @LineAttributes = split (/:/, $Line); my $TotalLineAttributes = scalar @LineAttributes; print "Line:... (4 Replies)
Discussion started by: ejdv
4 Replies