Tagged Questions
0
votes
1answer
22 views
Inserting element in an array of array in perl
Suppose i have a hash as below:
my @A=( 1,2,[[ 1,2 ],[ 3,4,5 ]], [ 6,7,8 ]);
How do i insert an array in the third element of the array above?
Third element here is an array of arrays and i want ...
0
votes
2answers
49 views
perl parsing and assigning multiple values to hash key using array
I have files that I'm trying to parse and build a hash and lookup from a third file. File format :
File 1:
ID2
ID4
File 2:
x1 y1 z1 ID1
x2 y2 z2 ID2
x3 y3 z3 ID2
x4 y4 z4 ID4
File 3:
a1 b1
...
0
votes
2answers
58 views
How to split array values into to separate arrays in perl
I have an array that stores lat/long together. For example:
@values[0] = "-0.709999984318709,60.690000003554324"
I am trying to separate this into two arrays, @lat and @long, based on the comma.
...
0
votes
2answers
68 views
split a string into array in perl
my $line = "file1.gz file1.gz file3.gz";
my @abc = split('',$line);
print "@abc\n";
Expected output:
file1.gz
file2.gz
file3.gz
I want the output to be file1.gz in $abc[0]
and $abc[1] should have ...
1
vote
3answers
70 views
Fun with array of arrays
I'm a total Perl newb, but still cannot believe I cannot figure this out with all the info I've read through online, but, I've burned too much time and am suffering from block at this point. Hoping ...
2
votes
1answer
67 views
Perl - Convert array to tree OR why variable changes arbitrarily
I am trying to convert following structure in perl (even elements are "parents" and odd are "childrens"):
$VAR1 = 'ng1';
$VAR2 = [
'ng1_1',
'ng1_2',
'ng1_3',
...
1
vote
2answers
40 views
Perl replace multiple strings simultaneously
Is there any way to replace multiple strings in a string?
For example, I have the string hello world what a lovely day and I want to replace what and lovely with something else..
$sentence = "hello ...
4
votes
3answers
57 views
Perl concept dynamic reference to an array
I am trying to understand in Perl the difference between a normal array reference
\@array and [@array].
Covered in the following article, http://perl-begin.org/tutorials/perl-for-newbies/part2/, it ...
1
vote
3answers
58 views
perl: trouble passing array to function
So all i want to do is pass a an array to a function (or subroutine) in PERL
So @Temp contains 2 arrays
[0] = {xx,xx,xx,xx,xx}
[1] = {xx,xx,xx,xx,xx}
#returns array containing two arrays
my @temp = ...
0
votes
1answer
29 views
PERL CGI::Ajax Passing Database Recordset in Array
Note: Those who would down vote(as question uses PERL CGI tags), go on, but please give me some hint or answer.
Hi,
On testing basis, I am making a webpage using Perl CGI::Ajax.
It has following ...
9
votes
4answers
197 views
Perl - built-in function to “zipper” together two arrays?
I want to merge two arrays of equal length into a single array by taking the first element from array A, the first element from array B; second element from A, second element from B, etc. The ...
0
votes
2answers
68 views
Ruby hashes with a primary and secondary key
The data I am reading in from a RabbitMQ queue has the following values: epoch, id, wait, length, max. I want to put this information into a hash of hashes. In Perl I would have done it like this:
...
4
votes
3answers
69 views
is any of array items contained in a string
I have a keywords list and a blacklist.
I want to delete all keywords that contain any of blacklist item.
At the moment Im doing it this way:
my @keywords = ( 'some good keyword', 'some other good ...
0
votes
3answers
28 views
Perl: Indexing function returning array syntax
I have a question about Perl more out of curiosity than necessity. I have seen there are many ways to do a lot of things in Perl, a lot of the time the syntax seems unintuitive to me (I've seen a few ...
0
votes
1answer
43 views
Adding unique elements to a Perl array determined by regex
I'm writing a perl script to analyze error codes and determining whether or not they are unique. The error is unique depending on what line it's on. A standard error message may be:
RT Warning: No ...