in reply to Pulling first 10 characters out of string?

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";
Update:
Did not see post by Eimi Metamorphoumai (below my depth setting)
This is somewhat of a repeat.