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
-3
votes
1 answer

Split array into arrays containing all elements with the same value

For example if I have this array: array={"a","b","c","d","a","d","b","d","z"} I want to split it to arrays that involves the same elements by Perl. The output should be like…
-3
votes
1 answer

Perl ::To find the no of occurenaces and max min value

Please help me to find the no of occurrences in file. also to find the max and min values. Im able to find the no of occurrences. file SQL :: select * from person ...etc , Time Taken :: 30 SQL :: select * from emp ...etc , Time Taken :: 5 SQL ::…
-3
votes
1 answer

How can I get the last-level values in a Perl hash-of-hashes into one array

In Perl, from the below hash: { 'item3' => { 'floors' => [ 'a', 'b', 'c' ] }, 'item1' => [ 'special' ] 'item2' => { 'books' => { 'topics' => [ 'epics' ] }, 'sports' => [ 'tennis' ] }, …
Nike
  • 25
  • 5
-3
votes
3 answers

Generating sets of array in perl

Given perl script cut the input sequence at "E" and skips those particular positions of "E" which is mentioned in @nobreak, and generates an array of fragments as an output. But I want a script which generates set of such array in output for every…
prashant
  • 97
  • 1
  • 1
  • 8
-4
votes
1 answer

In PERL how to pull records into array

in perl , I have table, i have fields like RANGE1, RANGE2, AND RECORDS around 6, i want to bring these 6 records into array, somthing like @arr = (range1_record_1, range2_record_1, range1_record_2, range2_record_2, range1_record_3,…
Bharanikumar
  • 25,457
  • 50
  • 131
  • 201
-4
votes
1 answer

I want to write my hash map data into Excel

Below is the output I got when I use print Dumper(\%Data) in my code { "" => undef, "123456789012:SRIRAMA" => [123456789012, "SRIRAMA", 856.06, 0, 0, 0], "389252737122:RAMA" => [389252737122, "RAMA", 345.76, 0, 0, 0], } This data I have to…
Rama
  • 1
  • 3
-4
votes
1 answer

XML document parsing

1000 2000 00
vmadhav
  • 35
  • 6
-4
votes
1 answer

perl parsing inserting new line and ^M

i am trying to modify a few strings in a file using perl by using the below logic.. open FILE1, "< /tmp/sam.dsl" //In read mode open FILE2, "> /tmp/sam2.dsl" // Open in write mode while() if($_=s/string/found/g) push FILE2, $_... I am able…
satishkumar432
  • 337
  • 1
  • 6
  • 19
-4
votes
1 answer

In Perl, how do I deeply compare data structures serialized to JSON format?

I have two data structures in JSON format. They are deeply nested hashes. How can I deeply compare these structures?
user2260554
  • 1
  • 1
  • 2
-4
votes
1 answer

Why is 1 assigned to a hash element?

Could any one explain what this statement does in Perl $type{$_->{brand}} = 1; I could understand that the hash %type has a key brand holding the reference to another hash brand and 1 is assigned to it what does it mean??!!! when it is assigned as…
user2064238
-5
votes
2 answers

Regarding complex hashes in perl

I have a hash of hash, where my first key is name and second is some classes like level A, level B, level C and the values is d total number of students.. %hash{name}->{class}->number So I fill my hash and everything is done but now when I print I…
user831579
  • 981
  • 1
  • 8
  • 8
-5
votes
1 answer

Filter textual data and count records corresponding to a specific value

From the data below I would like to find out how many unique "Over quota" lines there are corresponding to the ID values that start each line (e.g. 38148141CEB*), Each ID should only be counted once, even though there are multiple "Over quota"…
-5
votes
4 answers

Finding the file name with maximum numeric suffix

I have a list of files with mmddyyyy_nnnnn format. How do I find file with the highest number in postfix nnnnn using perl? Example: for these three files 11232014_00001 11232014_00002 11232014_00003 I want to return file name for 00003.
user4307331
1 2 3
25
26