Please note that what you getting is a warning, not an error. Warnings alert you of situations that can lead to possible problems, but they do not terminate your programs like errors do. For eg.
so any operation you do on '$string' (except an assignment) will produce the warning message, if you use 'use warnings' or -w option.