Ok .. so here is the part i feel ,if resolved will completely solve my problem .
@a = qw/Mon Tue Wed Thurs/;
foreach $key(@a)
{
push(@$key, $key);
print Dumper(\@$key);
}
The only problem with the above code is the array variable. Now there occur three possibilities
#Declare array as
push(@$key, #some values);
..
..
#The above code will help me to generate different arrays for multiple
+ variables but it does not help me to create a multi-dimensional arra
+y( Note: I cannot use an anonymous array here since i need to reitera
+te the entire loop over several days to measure performance and i cou
+ldnt find a way of pushing elements on to an anonymous array without
+creating a separate reference for it)
2. #Declare array as
push(@{$key[0]}, #some values);
..
..
#Alhtough this will help me to get the desired array format , however
+the most irritating part is that the variable $key is constant ,i.e e
+vn if i iterate it over a loop, only one array ( i.e @key is generate
+d and the reference for all the arrays is the same)
So, basically i am looking to create multiple arrays with the required references( multiple dimensions ,eg 2D).. Please help ..!!! I'm getting desperate now
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|