$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?
In reply to Re^3: Sorting unique values in file using perl
by jwkrahn
in thread Sorting unique values in file using perl
by PerlSavvy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |