#!/usr/bin/perl

use 5.038.2;

# mar 01 sep 2026 11:28:41 CEST
# mar 01 sep 2026 09:28:46 GMT

my $version = 0.002;

my $size = "1400";

# open my $myself, '<', $0 or warn "Can not open $0";       # la versión larga

if (-s $0 > $size) {
    say "Sorry, I'm afraid $0 is corrupted";
    exit -1;
}

####################################################################################

local $/='';                 # poor man slurp

unless (-e $ARGV[0] && -T $ARGV[0] && -s $ARGV[0] > 12) {
    say "Usage: $0 <filename>";
    say "";
    say "This script serv to see the text structured under xml 'free' format :-)\n";
}

open my $IN, '<', $ARGV[0] or die "Cannot open: $!";
my $file = <$IN>;
close $IN;

my @file;
@file = split "", $file;
my $ok = 1;
my $count = 0;
for my $c (@file){
    next unless defined $c;
    if ($c eq "<") { $ok=0; }
    elsif ($c eq ">") { $ok=1; print " "; }          # borra todo lo que hay entre tag '<' y tag '>'. Simple, pero eficaz 
    elsif ( $ok==0 ) { $count++; }
    
    if ($ok==1 && $c ne ">") {
        print $c;
    }
}
say "\nNúmero de caracteres encapsulados xml = $count\n";

__END__

This script was old. It serves me to read .docx and .xml 
  highly encapsulated deep. The problem is similar to that
  than the POSIX cmd 'strings' solve under ELF mode.

