Thanks. I was able to accomplish it using unpack command.
On Tue, Dec 9, 2008 at 7:26 AM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> sanju.shah wrote:
>>
>> I am looking for some suggestions on any advanced functions Perl might
>> have that i might be missing.
>>
>> Basically, I have an array with col
sanju.shah wrote:
I am looking for some suggestions on any advanced functions Perl might
have that i might be missing.
Basically, I have an array with column widths. Next I have a string. I
would like to extract the number of characters based on the column-
widths in the array. I have already tr
sanju.shah wrote:
>
> I am looking for some suggestions on any advanced functions Perl might
> have that i might be missing.
>
> Basically, I have an array with column widths. Next I have a string. I
> would like to extract the number of characters based on the column-
> widths in the array. I hav
On Mon, Dec 8, 2008 at 13:54, sanju.shah <[EMAIL PROTECTED]> wrote:
> I am looking for some suggestions on any advanced functions Perl might
> have that i might be missing.
>
> Basically, I have an array with column widths. Next I have a string. I
> would like to extract the number of characters ba
I am looking for some suggestions on any advanced functions Perl might
have that i might be missing.
Basically, I have an array with column widths. Next I have a string. I
would like to extract the number of characters based on the column-
widths in the array. I have already tried using substr but
hotkitty wrote:
Hi,
Hello,
I have two arrays, as follows:
Array1=(
date 11/01/2008 newstuff1,
date 10/27/2008 newstuff2,
date 10/24/2008 newstuff3
)
Array2=(
date 11/01/2008 oldstuff1,
date 10/31/2008 oldstuff2,
date 10/30/2008 oldstuff3,
date 10/29/2008 oldstuff4,
date 10/28/2008 oldstuff5
On Sun, 2008-11-16 at 08:35 -0800, hotkitty wrote:
> How do I combine the arrays so that the the "newstuff" in array1 gets
> appended only to an item in array2 if the dates match?
Create a hash of lists with the dates as its keys. Go through Array2
and push each oldstuff on the list stored in the
Hi,
I have two arrays, as follows:
Array1=(
date 11/01/2008 newstuff1,
date 10/27/2008 newstuff2,
date 10/24/2008 newstuff3
)
Array2=(
date 11/01/2008 oldstuff1,
date 10/31/2008 oldstuff2,
date 10/30/2008 oldstuff3,
date 10/29/2008 oldstuff4,
date 10/28/2008 oldstuff5,
date 10/27/2008 oldstuff6,
Thank you, Tom, that is exactly what I was looking for!!
Thanks again!
-Greg
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Thursday 25 October 2007 11:03, [EMAIL PROTECTED] wrote:
> Hi
Hello, Please do not top-post, TIA.
> This will do what you want:-
>
> perl -le '@test=(1,2,3,4,5);print join "\n",@test;'
>
> The -l option ensures a final newline after the last element of the
> array is printed. The order of t
On 10/25/07, Greg <[EMAIL PROTECTED]> wrote:
> my @record = split (/\|/,$_); #split on '|' characters
> My question comes in, how do I put the |'s back in the line in memory
> so that I can continue with my working script?
I think you're looking for join(), maybe something like this:
my $li
I have a similar issue as the other person with the same subject but
with a twist..
I am reading an input file in that is pipe delimited and want to do
manipulation on one of the fields.
So far I have (and I'm only going to give you bits and pieces...
unless requested)
my @record = split (/\|/,
Similar issue here, but with a twist.
I have an input file that I'm reading in that is pipe delimited. (HL7
actually)
So far I have
my @record = split (/\|/,$_);
I want to take $record[16] and replace it with $record[16] /
$record[7] ONLY if $record[7] is not empty.
I have this accomplished by
$co
Hi
This will do what you want:-
perl -le '@test=(1,2,3,4,5);print join "\n",@test;'
The -l option ensures a final newline after the last element of the array is
printed. The order of the options is important as changing it to "el"
wouldn't
work.
--
Andrew
Edinburgh,Scotland
On Thu, 25 Oct
On Oct 25, 4:21 pm, [EMAIL PROTECTED] (Ron Bergin) wrote:
>
> print $_,$/ for @test;
Nothing wrong with that, but I usually write:
print "$_\n" for @test;
TMTOWTDI!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Oct 25, 1:59 am, [EMAIL PROTECTED] (Irfan Sayed) wrote:
> Hi All,
>
> I have one array say my @test=(1,2,3,4,5);
> if I print this array it will print like this
> print "@test\n";
> and the output is
> 1 2 3 4 5
>
> now my req. is that I want to store these array values in another array
> in suc
r reference.
Please guide.
Thanks in Advance.
Regards
Irfan.
-Original Message-
From: Gunnar Hjalmarsson [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 25, 2007 5:06 PM
To: beginners@perl.org
Subject: Re: Array Manipulation
Sayed, Irfan (Irfan) wrote:
> I have one array say my
Sayed, Irfan (Irfan) wrote:
I have one array say my @test=(1,2,3,4,5);
if I print this array it will print like this
print "@test\n";
and the output is
1 2 3 4 5
now my req. is that I want to store these array values in another array
in such a fashion where I can print like
1
2
3
4
5
so I me
On 25 Oct 2007, at 4:59 PM, Sayed, Irfan (Irfan) wrote:
Hi All,
I have one array say my @test=(1,2,3,4,5);
if I print this array it will print like this
print "@test\n";
and the output is
1 2 3 4 5
so I mean to say that if I type print "@test1\n";
then output should come as
1
2
3
4
5
Try ma
Hi All,
I have one array say my @test=(1,2,3,4,5);
if I print this array it will print like this
print "@test\n";
and the output is
1 2 3 4 5
now my req. is that I want to store these array values in another array
in such a fashion where I can print like
1
2
3
4
5
so I mean to say that if I t
-Original Message-
>From: "Sayed, Irfan (Irfan)" <[EMAIL PROTECTED]>
>Sent: Feb 13, 2007 7:12 PM
>To: beginners@perl.org
>Subject: FW: Array manipulation
>
>
>Hi All,
>
>I have one array having values as follows
>
>User [EMAIL PROTECTE
>
>@a = (1,2,3,4,2,3,5);
>
>print "---> @a\n";
>my %b = undef;
>foreach (@a){
>
>print "--- $_";
> $b{$_} =undef;
>}
>
>@a = keys(%b);
>
>print "\n### @a";
>
Hmm,that will break the order of the original array.
--
Jeff Pang
EMAIL: [EMAIL PROTECTED] AIM: jeffpang
--
To unsubscribe, e-mai
I got the output like ..
P:\>"C:\Documents and Settings\rkilaru\Desktop\prog.pl"
---> 1 2 3 4 2 3 5
--- 1--- 2--- 3--- 4--- 2--- 3--- 5
### 4 1 3 2 5
P:\>
Rajeev
On 2/13/07, kilaru rajeev <[EMAIL PROTECTED]> wrote:
Hi Irfan,
Please find the following way.
@a = (1,2,3,4,2,3,5);
prin
Hi Irfan,
Please find the following way.
@a = (1,2,3,4,2,3,5);
print "---> @a\n";
my %b = undef;
foreach (@a){
print "--- $_";
$b{$_} =undef;
}
@a = keys(%b);
print "\n### @a";
rgds,
Rajeev Kilaru
On 2/13/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote:
Hi All,
I have
Hi All,
I have one array having values as follows
User [EMAIL PROTECTED]
User [EMAIL PROTECTED]
User [EMAIL PROTECTED]
Now I formatted above array as per your suggession as follows in order
to remove duplicate value "User"
@test = grep { ++$hash{$_} < 2 } @test;
but output is as follows which
Jeff Pang schreef:
> [un-double]
> @test = grep { ++$hash{$_} < 2 } @test;
Alternative:
@test = grep { !$hash{$_}++ } @test;
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
>
>I have one array say @test = (1,2,3,2,5). Now if you observe 2 is
>repeating in this array on second position and fourth position.
>
>My requirement is that if such value is repeating twice then i just want
>to remove one value and keep other value.
>
>So my array should look like @test = (1
On 2/9/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote:
I have one array say @test = (1,2,3,2,5). Now if you observe 2 is
repeating in this array on second position and fourth position.
My requirement is that if such value is repeating twice then i just want
to remove one value and keep othe
Hi All,
I have one array say @test = (1,2,3,2,5). Now if you observe 2 is
repeating in this array on second position and fourth position.
My requirement is that if such value is repeating twice then i just want
to remove one value and keep other value.
So my array should look like @test = (1,
--- David Greenberg <[EMAIL PROTECTED]> wrote:
> I'm sure there's an easier/better way of doing this,
> but in the interest of
> simplicity, let's look at this approach:
>
> First, a red flag goes up when you say that you have
> an array of 12
> numbers. Will it always be twelve?
>
> The seco
I'm sure there's an easier/better way of doing this, but in the interest of
simplicity, let's look at this approach:
First, a red flag goes up when you say that you have an array of 12
numbers. Will it always be twelve?
The second red flag is that you are splitting the array into quarters based
I have an array contains 12 numbers. I want to
calculate the mean and standard deviation for very
three numbers. I just wonder which math module is
available to do the job.
Wonder no longer :) Find out for sure:
http://search.cpane.org/
I think you meant http://search.cpan.org. :)
Inde
-Original Message-
From: JupiterHost.Net [mailto:[EMAIL PROTECTED]
Sent: Monday, August 14, 2006 4:48 PM
To: beginners@perl.org
Subject: Re: math module and array manipulation
> chen li wrote:
>> Dear all,
>>
>> I have an array contains 12 numbers. I want to
>
chen li wrote:
Dear all,
I have an array contains 12 numbers. I want to
calculate the mean and standard deviation for very
three numbers. I just wonder which math module is
available to do the job.
Wonder no longer :) Find out for sure:
http://search.cpane.org/
--
To unsubscribe, e-mail:
Dear all,
I have an array contains 12 numbers. I want to
calculate the mean and standard deviation for very
three numbers. I just wonder which math module is
available to do the job.
Thanks,
Li
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the
Ahhh.. Ok. I see the mistake. I've purchased Oreilly's "Learning Perl"
3rd Edition and have been steadily plugging through it. There is an
example on page 45 which shows another way to populate an array. Here
is one such example they give.
@numbers = 1..1e5;
So basically if you didn't want
On 12/25/2003 12:18 PM, u235sentinel wrote:
But wouldn't the original initilization also work?
@array1[0..5] = 1;
No. Think of this in terms of parallel assignment, ignoring for the
moment that we are talking of arrays, the above is equivalent to:
($e0, $e1, $e2, $e3, $e4, $e5) = 1;
which is e
nts as a group.
Randy.
- Original Message -
From: Randy W. Sims
To: Duong Nguyen
Cc: [EMAIL PROTECTED]
Sent: Thursday, December 25, 2003 3:02 AM
Subject: Re: Perl Help: Array Manipulation
On 12/25/2003 2:51 AM, Duong Nguyen wrote:
> From: Randy W. Sims
Understood. I guess I was trying to show him ( the senec route) that
basically no running total was being compiled. Also that wasn't
the total. I guess it was too late at night for a simple response from
me :-)
Charles K. Clarkson wrote:
u235sentinel <[EMAIL PROTECTED]> wrote:
[snippe
u235sentinel wrote:
> I'm a newbie to perl also. Been workign with it for a whole 2 weeks
> now. Actually.. make that 3 ::grinz::
>
> Warning.. lengthy email below.. I beg forgiveness in advance :-)
Length isn't a problem. There are some problems here, though, because you
are not addressing th
But wouldn't the original initilization also work?
@array1[0..5] = 1;
This seemed to populate the array just fine.
Randy W. Sims wrote:
On 12/25/2003 2:51 AM, Duong Nguyen wrote:
From: Randy W. Sims
>
On 12/25/2003 12:59 AM, Duong Nguyen wrote:
> Hello everyone,
> > Sorry for the
Duong Nguyen wrote:
>
> Hello everyone,
Hello,
> Sorry for the spam,
Why do you think that this is spam?
> I am new to Perl and am having a hard time manipulating
> arrays. Below is the sample code that I am working on:
You should have warnings and strictures enabled while you are developing
u235sentinel <[EMAIL PROTECTED]> wrote:
[snipped valiant attempt]
:
: So now you see on the left the sum of each container in the array.
:
: Ok.. I await the flogging. Someone is bound to have done a better job
: explaining this. At least I can blame it on being up after
: midnight ;-)
Duong Nguyen <[EMAIL PROTECTED]> wrote:
:
: Thanks for the response. I discovered that it was my
: @array1[0..5] =1; initialization.
: So I manually allocated values to the array to see if it
: would work, much to my surprise, the correct "total" was
: being printed. Here's what I did:
:
: c
On 12/25/2003 2:51 AM, Duong Nguyen wrote:
From: Randy W. Sims
>
On 12/25/2003 12:59 AM, Duong Nguyen wrote:
> Hello everyone,
>
> Sorry for the spam, I am new to Perl and am having a hard time manipulating arrays. Below is the sample code that I am working on:
>
> @array1[0..5]
@array1[0] = 1;
@array1[1] = 1;
@array1[2] = 1;
This works well.
- Original Message -
From: u235sentinel
To: Duong Nguyen ; [EMAIL PROTECTED]
Sent: Thursday, December 25, 2003 2:40 AM
Subject: Re: Perl Help: Array Manipul
On 12/25/2003 12:59 AM, Duong Nguyen wrote:
Hello everyone,
Sorry for the spam, I am new to Perl and am having a hard time manipulating arrays. Below is the sample code that I am working on:
@array1[0..5] = 1;
@total[0] = 0;
for($i=0; $i<4; $i++)
{
if($i == 0)
{
@total[$i] =
I'm a newbie to perl also. Been workign with it for a whole 2 weeks
now. Actually.. make that 3 ::grinz::
Warning.. lengthy email below.. I beg forgiveness in advance :-)
Ok. Here is what I did.
#!/usr/bin/perl
@array1[0..5] = 1;
@total[0] = 0;
for($i=0; $i<4; $i++)
{
if($i == 0)
{
Hello everyone,
Sorry for the spam, I am new to Perl and am having a hard time manipulating arrays.
Below is the sample code that I am working on:
@array1[0..5] = 1;
@total[0] = 0;
for($i=0; $i<4; $i++)
{
if($i == 0)
{
@total[$i] = @array1[$i];
print @total[$i];
49 matches
Mail list logo