Pages

Friday, September 27, 2013

Can't find string terminator "EOF " anywhere before EOF at test.pl line 21.

This issue will come when you are using EOF or EOM string to send multiple line to a perl print statement or a command. Just have look at below code

I have a file descriptor which will take input from a string as shown below.

printf FD1 "this my first line";

This will work with out any issue, but when you want to send multiple lines as shown below we have to use PERL here-docs as shown below.

printf FD1 << EOM;
statement1
statement2
EOM

other than this syntax, if you give any other thing it will fail. Observe that there is no double quotes before or after EOM and there is a ; colon after first EOM. We even have to remember that there should not be any space between << and EOM. Hope this helps some one who did this mistake.

0 comments:

Post a Comment