How can I assign the string to the $version variable without using the '$&' ?my $file = '/etc/redhat-release'; # content of /etc/redhat-release # CentOS Linux release 7.6.1810 (Core) open(SOURCE, '<', $file); <SOURCE> =~ m/(?<=release )\d/; close SOURCE; my $version = $&; print "The version is: $version\n";
In reply to Read text in file and assign to variable by maxamillionk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |