in reply to Split on a new line
Putting a "zero or more characters from this class" regular expression into split (as in split /\n\r\l*/) effectively splits a string into individual characters - the regex is true between every single character. Your code would get further if you tried split /\n\r\l+/ ....
Using regular expression matches, you could do something like:
#!/usr/bin/perl use strict; use warnings; undef $/; # read whole file at once our $cert = <>; our ($info) = $cert =~ m/X509v3 Basic Constraints:\s+([^\n]+)/; print "Constraints = $info\n";
|
---|