$newfile = "0001"; $char = substr($newfile,0, 4); $char =~ s/0//; print"$char\n"; $test = $$char + "1"; print"$test\n";