I have a script that would check a xml file and find me strings that are between tags <Register> ...</Register>
script is :
while (my $line = <FILE>)
{
if ($line =~ m/<Register>/)
{
my $nextline =<FILE>;
if ($nextline =~ /^(.*)]*<\/Register/)
{
my $string = $1...
The Program code:
use strict;
use warnings;
my @register_list;
open (FILE, "Peint_FcN.xml");
while (my $line = <FILE>)
{
if ($line =~ m/<Register>/)
{
my $nextline =<FILE>;
if...
if ($string =~ /(.*?)u(.*)/s)
{
my $pre = $1;
my $post = $2;
for my $index(0..4)
{
print "$pre$index$post\n";
push(@register_list, "$pre$index$post");
}
}
is there a way to make it print like 0,1,2,3,4 and not just 1,2,3,4??
Thank you very much Miller, but this would just work for that particular string. I have a numerous of those lines in an array, and I need to read an array and for every single line that has a 'u' it has to replace it with those 4 other substitutions I need and print that out.
I have a file with content and I'm extracting information from it and storing it in an "array" and I have number of statements in that array. So when I see something like this "FRSVTu_ORT_TRU" in the array I should be able to do something and print out this
output:
FRSVT0_ORT_TRU...
How can I point to an array using hash?
I have an array and I have a hash, I want the data in the array to be accessed through hash. How can I do that??
Please help me out. Thank you in advance.
perl script:
use strict;
use warnings;
open FILE, "reg_sample.xml" or die $!;
while (my $line =<FILE>){
if($line= ~ m/<Register> (.*?) <\/Register>/g)
{
print $line;
}
}
I just realized that in the xml file, I see register in following format:
<Register>...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.