Questions tagged [perl-data-structures]

Discussion of Perl's three built-in data types: scalars, arrays of scalars, and associative arrays of scalars, known as "hashes". At your command-line: perldoc perldata

perldata - Perl data types

perldsc - Perl Data Structures Cookbook

388 questions
-1
votes
1 answer

Perl script to convert xlsx to xml giving error

I am trying to convert xlsx to xml using Perl modules. According to my requirement the Perl script should take .xlsx file and convert to .xml format exactly. While compiling my code I am getting error: print() on unopened filehandle XML at…
Sri
  • 33
  • 1
  • 8
-1
votes
1 answer

getValue from an XML having same attributes using Perl XMLDOM parser

I am trying to get the value of 'TaxAmount' from the below XML which contains same tag name at different places. From the below XML, I want to get the value of 'TaxAmount' as '7.2' under tag 'Order', but I'm always getting the 'TaxAmount' as '1.2'…
Logunath
  • 477
  • 1
  • 8
  • 20
-1
votes
1 answer

How to use refernce concept and access element of subroutine argument using Perl?

I am writing a code for calling a subroutine which has 4 argument(3 hashes and one file handler).i want to know how to access them in subroutine.My code is as below. #print OUTFILE "Content of TPC file:.\n"; my $DATA_INFO = $ARGV[0]; my $OUT_DIR =…
Pooja shah
  • 15
  • 1
  • 8
-1
votes
1 answer

memory issue occurs randomly for few jobs

I am receiving a out of memory issue when providing the huge file data as a argument. I have checked the memory size it has free space 2045 mb. Is that sufficient for the swap space to sort the records in hash ref value. please let me know what…
Arun A
  • 1
  • 1
-1
votes
2 answers

How to run set of .exe files in a folder through .bat file using perl script

I am beginner to Perl and I have to create a .pl file and I have folder containing near about 30 exe files(inside Folder1 in G:\Folder1). All of them must be executed by click to the .pl file. My try is : use strict; use warnings; use autodie; …
user3085082
  • 133
  • 4
  • 16
-1
votes
1 answer

how to execute the perl script when the script names are written in txt file

Question : I have a normal txt file which has Perl Script names and flag set to it,please see example below, i want to read that txt file and if the flag is set to 1 then execute the perl scripts . How to do this ? test.txt TC1connect.pl =…
-1
votes
1 answer

Substituting variables while reading text file

I have a text file as below and saved it as "file.txt" "create variable $VAR alarm_object 0" I am trying to read this in a perl script and printing it by substituting the "$VAR" variable $VAR = TEMP_VAR open (FILE,"<", "file.txt") or die $!; …
Mohan
  • 463
  • 3
  • 11
  • 24
-1
votes
3 answers

Perl Date conversion with Perl's built-in functions

I have a date in the following format which is how it is stored in an external application 06/12/2014 6:31 PM IST I want to change this format to which needs to check AM and PM also and rest of the minutes to be hardcoded as :00+5:30 2014-06-12…
user3264858
  • 51
  • 1
  • 8
-1
votes
1 answer

To delete Multiple block of data from a file in perl?

The above entry comes in my file for around four times and I want to remove those entries from the file, so I'm using the following logic: #!/usr/bin/perl $count=0; open (FILE,…
user1954970
  • 409
  • 1
  • 5
  • 14
-1
votes
1 answer

How to search for a particular string and goto sleep if not found in perl?

I have two test cases in log file ActivateJob and GetJOBStatus as below, my perl script currently set to PASS as default and it searches for Error in the below test cases, if it finds error in the below it makes test case as FAIL. For GetJOBStatus…
user1954970
  • 409
  • 1
  • 5
  • 14
-1
votes
3 answers

how to declare array reference in hash refrence

my $memType = []; my $portOp = []; my $fo = "aster.out.DRAMA.READ.gz"; if($fo =~/aster.out\.(.*)\.(.*)\.gz/){ push (@{$memType},$1); push (@{$portOp},$2); } print Dumper @{$memType}; foreach my $mem (keys…
Rahul Reddy
  • 12,613
  • 10
  • 22
  • 21
-1
votes
1 answer

Use of uninitialized value in subroutine entry at mytest.pl

#!/usr/bin/perl use strict; use warnings; use List::Util qw(min max); use Set::IntervalTree; use GenomeLookupUtil; my $chromCol = 0; my $startCol = 0; my $endCol = 0; if($ARGV[2] eq "VSC") { $chromCol = 0; $startCol = 1; $endCol =…
Syed
  • 19
  • 1
  • 6
-1
votes
2 answers

group lines by column and print one value

I have a file which looks like below: LINE abc 1 somevalue LINE abc 1 somevalue LINE abc 1 somevalue LINE def 2 somevalue LINE def 2 somevalue LINE abc 3 somevalue LINE abc 3 somevalue LINE mno 4 somevalue LINE mno 4 somevalue LINE def 5…
user919019
-1
votes
1 answer

How do I use a 2 dimensional array for accessing data in a file using Perl?

I am new to Perl coding & am facing a situation. Here is the problem statement: I have a file which contains some data (only numbers) in matrix form like 1 2 3 4 5 6 ....... 7 9 4 6 7 8 ....... ................... ................... I have another…
Samir
  • 3
  • 1
-1
votes
3 answers

Hash of Hashes in Perl

I have the question in Perl:Input 5 mobile set details (Invoice number, Model , Company, Memory , Price , Quantity ). Print all the details, total amount (quantity * price) , total quantity , number of mobiles from each company. My script…
user1613245
  • 343
  • 5
  • 14