473,395 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

processing array

I have an array @arr as:

aa bb cc
dd ee ff
gg hh kk
tt yy uu

I need to extract the second coulmn from this & push it to another array called @brr so that it contains only

bb
ee
hh
yy
Oct 29 '09 #1
2 1801
toolic
70 Expert
Assuming @arr is an Array-of-arrays:

Expand|Select|Wrap|Line Numbers
  1. use strict;   
  2. use warnings;
  3. use Data::Dumper;
  4.  
  5. my @arr = (
  6.   [qw(aa bb cc)],
  7.   [qw(dd ee ff)],
  8.   [qw(gg hh kk)],
  9.   [qw(tt yy uu)]
  10. );
  11. my @brr;
  12. push @brr, $_->[1] for @arr;
  13. print Dumper(\@brr);
  14.  
  15. __END__
  16.  
  17. $VAR1 = [
  18.           'bb',
  19.           'ee',
  20.           'hh',
  21.           'yy'
  22.         ];
  23.  
Oct 30 '09 #2
Thanks toolic for the reply.
Oct 30 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: jdemello | last post by:
When using a multidimensional associative array to cross-reference data in a second, single-dimensional array, PHP stops processing data after a few iterations. Memory usage according to the task...
8
by: dmcconkey | last post by:
Hi folks, I have a client with four websites. Each site has a contact form that is identical. They all have "required" fields validated through a JavaScript onSubmit() function. Upon validation,...
23
by: Daniel Rudy | last post by:
Hello, I'm trying to learn how command line arguments are handled in C. The following code segment that I wrote as a test program compiles, but when I try to run it, it core dumps. This is...
0
by: Claire | last post by:
My application has a thread reading byte arrays from an unmanaged dll(realtime controller monitoring). The array represents an unmanaged struct containing a series of header fields plus a variable...
3
by: pemo | last post by:
Opinion please. The code below is an attempt at demonstrating commandline arg processing. I don't really like the repetitive use of ... if(!(*s)) { // Make sure we don't go out of bounds....
5
by: paul | last post by:
Hi all, Could some kind soul peruse the following code and see if there is anything wrong with it? Its producing output, but its only occupying the first third of the output array; to give an...
5
by: B. Williams | last post by:
I need some assistance with random access file processing. I have a function that I would like to change from sequential file processing to random access. Thanks in advance. void...
0
by: msg4james | last post by:
G'day folks, I have an intriguing question, one which most programmers have been talking around, and the solutions I have seen posted often inadequate: <INPUT TYPE=CHECKBOX NAME="Profession" ...
9
by: John [H2O] | last post by:
Hello, I'm trying to do the following: datagrid = numpy.zeros(360,180,3,73,20) But I get an error saying that the dimensions are too large? Is there a memory issue here? So, my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.