Update:use strict; my $x = "12345678901234"; # This evalutes the regex and prints the result print $x =~ /^(\d{10})/; print "\n"; $x = "12345678901234"; # This evaluates the regex but the result is not assigned anywhere. So + you get back $x $x =~ /^(\d{10})/; print "$x\n"; $x = "12345678901234"; # This evaluates the regex and assigns the result to $y my ($y) = $x =~ /^(\d{10})/; print "$y\n"; $x = "12345678901234"; # This perform a substitution, returning the result in $x $x =~ s/^(\d{10})\d*$/$1/; print "$x\n";
In reply to Re: Pulling first 10 characters out of string?
by nedals
in thread Pulling first 10 characters out of string?
by mav1c
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |