in reply to file is replaced

holli gave you a complete, working, OO-based program with reusable modules at Re: Split file based on tag in response to your Split file based on tag. You previously had answers at file split, print line, and delete line. You then asked again at change the filename.

If for some reason you cannot use holli's excellent solution to your problem, you should be able to extract the techniques you need from that code.

To start with, read the open documentation, then look for it in your script. Check the variables used by open in your script and trace them back to where they were set. Then look at holli's Re: Split file based on tag and do the same. Change your script based on what you just learned. If it then does what you want - great! If not, come back here, post what you did, what you thought would happen, and what did happen.

There are many Monks here happy and willing to help you, but very few willing to do the work for you. Show some effort, explain your thinking as to what should happen, and someone will gladly guide you.

Replies are listed 'Best First'.
Re^2: file is replaced
by Anonymous Monk on Dec 01, 2009 at 10:51 UTC
    020200001117VUTVS01 00000745B3^V^V^A2^C^D^V^V^A 0000 0001 090104 N S00 +00000000 00001889^B{IT}R
    If I use the {IT} like this, I code doesn't works.
    while (<DATA>) { s/.*?\{IT\}(.*)/{IT}\n$1/g; s/^\s*//g;
    I tried substituting the {IT} as above.
    It's giving the error as Can't use an undefined value as a symbol reference at new.pl line 64, <DATA> line 4.
    When I try to print,
    print "The tag is---->$tag\n\n";
    IT is not taken into consideration as tag value.
    but gives out the error message as Can't use an undefined value as a symbol reference at new.pl line 64, <DATA> line 4.