The above works, but I need to print the variable later in my code. When I try to print the variable $public_key_type outside the block the variable becomes empty. Does anyone have a suggestion on how I can keep the data in the variable once it leaves the block?====================================================== if ( $line =~ /^Public Key Type:/ ) { $public_key_type = scalar <DATA> for 1; $public_key_type =~ s/^\s+//; $public_key_type =~ s/\s+$//; $public_key_type = "$public_key_type"; $public_key_type =~ s/\R//g; print "$public_key_type\n"; } ======================================================
In reply to variable has value but then become empty by Randy_j53
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |