in reply to Writing on different output files.

Hi. I think this code will guide you. Notice switch '-w' and string 'use strict' - it must be there always.
#!/usr/bin/perl -w use strict; use warnings; while(<DATA>){ if (/<STANDARD>.*/) { print; } if (/>JN.*/) { print; } } __DATA__ <DIVIDER>file.txt</DIVIDER> <STANDARD>.... .... ... <DIVIDER>file.txt</DIVIDER> >JN....