Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Sorting unique values in file using perl

by jwkrahn (Monsignor)
on Oct 24, 2012 at 04:07 UTC ( #1000550=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Sorting unique values in file using perl
in thread Sorting unique values in file using perl

$path =~ /([^\s]+)/; $path = $1; #Extracting path ... $slack =~ /[^\f+][\s+][\f+][\s+][\f+][\s+]([\f+]+)[\s](VIOLATED)/; $slack = $1;

You shouldn't use the results of a regular expression unless you verify that the pattern matched or you may get erroneous results.    Also /([^\s]+)/ is usually written as /(\S+)/ and /[^\f+][\s+][\f+][\s+][\f+][\s+]([\f+]+)[\s](VIOLATED)/ matches a single character that is not a FORM FEED or '+' character, followed by a whitespace or '+' character, followed by a FORM FEED or '+' character, etc., but there are no FORM FEED characters in the string.



chop($path); ... chop($slack);

chop removes the last character of the string, no matter what it is.    So what is the purpose of removing the last character from $path or $slack?




Comment on Re^3: Sorting unique values in file using perl
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000550]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-07-11 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (222 votes), past polls