Unless you've done something to $/ which you haven't mentioned, then $_ won't contain newlines inside the while, since the while is already splitting the data up by line.
If you want each line in it's own element in the array, then you are going about it the hard way...
my $SSL = "/usr/local/bin/sudo /usr/bin/openssl"; chomp( my @array = `$SSL x509 -inform PEM -text -noout -subject -issue +r -in /tmp/expiredcert.crt 2>/dev/null` );
Or, if you still want to do it with open...
my $SSL = "/usr/local/bin/sudo /usr/bin/openssl"; local (*FH); open (FH, "$SSL x509 -inform PEM -text -noout -subject -issuer -in /tm +p/expiredcert.crt 2>/dev/null |") or return; my @args = <FH>; close FH;
| We're not surrounded, we're in a target-rich environment! |
|---|
In reply to Re: Split on a new line
by jasonk
in thread Split on a new line
by Luken8r
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |