I am new to perl and want to learn how to extract sub strings in a scrip. I want to use the metadata in a picture.jpg to create a caption. I want to extract the date stamp of 2017:06:12 from the variable. What am I missing? Thanks.

./test1.pl Name "main::dtg" used only once: possible typo at ./test1.pl line 15. Region Name : Lily, Angel, Travis print() on unopened filehandle 0 at ./test1.pl line 9. print() on unopened filehandle Create Date : 2017:06:12 07:13:32 Use of uninitialized value in print at ./test1.pl line 15.

=======================

What am I missing? Why is a CLI and bash script so different from a perl script?