Link to home
Start Free TrialLog in
Avatar of boofulls
boofulls

asked on

last 3 chars

how do i assign a new variable to be the last three characters of a variable

ie if $old is "hello.txt"
then $new becomes "txt"

thanks
ASKER CERTIFIED SOLUTION
Avatar of spreq
spreq
Flag of Afghanistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of boofulls
boofulls

ASKER

even though there was an error in the last line....;)
Avatar of ozo
$new=substr($old,-3);  #unless what you really want are all characters after the last '.'