in reply to Re: Split file based on tag
in thread Split file based on tag

sub xml_output { my ($output, $tag, $fh) = @_; if($output) { if($output =~ m/<IT>(.*)/) { if($fh) { print $fh "</ROOT>\n"; close($fh); } open($fh, '>', "$1.xml") or die "$1.xml: $!"; print $fh "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<RO +OT>\n"; } $output =~ s/\s*(?=(<.+>|<.+\/>|<\/.+>|<\/.+><.+>))//g; print $fh "$output</$tag>\n"; } return($fh); } # End of sub sroutine
Please tell me how can i change in the this subroutine to split the file until it finds {IT} tag and filename as the {TAG} value. Please help me with this

Replies are listed 'Best First'.
Re^3: Split file based on tag
by holli (Abbot) on Nov 28, 2009 at 13:02 UTC
    Go and buy yourself a working brain.


    holli

    You can lead your users to water, but alas, you cannot drown them.