In my Perl program, I am reading an email by decoding it, splitting it into an array. In the snippet below, I am reading the elements and appending it until I find 'Email' or 'Phone' or 'GoToAssist'.
75 while(!($plain[$j] =~ /[Email|Phone|GoToAssist]/)){
76 $plain[$x] .= " " . $plain[$j];
77 $j++;
78 }
However, I am getting the following error:
Use of uninitialized value in concatenation (.) or string at test.pl line 76, <GEN0> line 921.
Use of uninitialized value in pattern match (m//) at test.pl line 77, <GEN0> line 921.
The code was working properly previously, I have hardly changed anything. I am wondering what went wrong.
$plain[$j]is undefined. We cannot help you to fix this unless you show your complete code. Also the regex/[Email|Phone|GoToAssist]/doesn't do what you intend. It uses a character class that matches any of the charactersA E G P T a e h i l m n o s t |. You want just/Email|Phone|GoToAssist/.