Re: help with array elements

2011-03-12 Thread ashwin ts
Hi,

Thank you all for the support.It helped me a lot.i tried working with arrays
as well as with hash.Both the approaches works fine in the case of a small
array with few elements.
When i tried the same for a large array , i started getting out of memory
error.
Any suggestions would be of great help.

Thanks again,

Regards
Ashwin Thayyullathil Surendran



-- Forwarded message --
From: ashwin ts ashwint...@gmail.com
Date: Sat, Mar 12, 2011 at 1:17 PM
Subject: help with array elements
To: beginners@perl.org


Hi,

I am a newbie to perl.
I have an array which has few elements like '1,2,3,4,2,3,1,2,1,1,1,4,6,7'
i need to know how many times each element has occurred in the same array.
for example 1-5 times
  2-3 times...
could some one throw some light on how i can do this.
thanks in advance..

Regards
Ashwin Thayyullathil Surendran


help with array elements

2011-03-11 Thread ashwin ts
Hi,

I am a newbie to perl.
I have an array which has few elements like '1,2,3,4,2,3,1,2,1,1,1,4,6,7'
i need to know how many times each element has occurred in the same array.
for example 1-5 times
  2-3 times...
could some one throw some light on how i can do this.
thanks in advance..

Regards
Ashwin Thayyullathil Surendran


Re: doubt in substring

2011-01-12 Thread ashwin ts
the output will be

cat sat on the

all the characters in the string $str except four characters from the left
and right will be displayed...

Regards
Ashwin Thayyullathil Surendran



On Thu, Jan 13, 2011 at 9:57 AM, Sunita Rani Pradhan 
sunita.prad...@altair.com wrote:

 Hi All



I have a string as; $str =  the cat sat on the mat .



 How the following command works substr($str , 4, -4)  on the string ?
 What should be the output?







 Thanks

 Sunita




MQSeries ... help needed

2010-12-07 Thread ashwin ts
 hello ,

My name is ashwin and i am new to perl.
I have a requirement where in i need to send messages to MQSeries..
I assume that for the same .. i need to install the MQSeries package in my
existing perl.i use a unix environment.The version of perl that i am using
is v5.8.2,
can you please guide me in installing a module from CPAN on to my unix
machine..

this is what i have done so far...
i gave cpan MQSeries ...

 the following is displayed on my screen which i think is an error...

Checking if your kit is complete...
Looks good
Warning: prerequisite Convert::EBCDIC 0.06 not found.
Warning: prerequisite Params::Validate 0.89 not found.
Warning: prerequisite Test::Pod 1.20 not found.
Warning: prerequisite Test::Simple 0.62 not found. We have 0.47.
ERROR from evaluation of /home/spokuri/.cpan/build/
MQSeries-1.31/MQClient/Makefile.PL: No such directory '/usr/lpp/mqm'
Compilation failed in require at ./Makefile.PL line 14.
# Looks like your test died before it could output anything.
Running make test
  Make had some problems, maybe interrupted? Won't test
Running make install
  Make had some problems, maybe interrupted? Won't install

Thanks in advance...

Regards
Ashwin Thayyullathil Surendran
#91 988732


materials on MQ series

2010-12-01 Thread ashwin ts
hello,

can some one please let me know about where i can find materials on perl
MQSeries...
Thanks in advance..

Regards
Ashwin Thayyullathil Surendran
#91 988732


Re: This Perl code causing high cpu usage , Why ?

2010-10-30 Thread ashwin ts
Hello Jathin,

The problem with the code is that its gone in to an infinite loop..
The pattern matching that u have done u need to make it global or for all
occurances.
..
The /g option is used to match all the patterns in the given string
u can try this..

while ($catalog =~ /Perl/g)

Regards
Ashwin Thayyullathil Surendran
#91 988732


On Sat, Oct 30, 2010 at 1:00 PM, Jatin daveyja...@gmail.com wrote:

 Hi All

 I had a sample code from the PerlLWP book. It was the very first code i
 was trying out in different ways. Firstly the actual code mentioned in the
 book was as below:

 --
 #!/usr/bin/perl
 use warnings;
 use strict;
 use LWP::Simple;

 my $catalog = get(http://oreilly.com/store/complete.html;);

 my $count = 0;

 while ($catalog =~ /Perl/gi) {
$count++;
}


 print Perl was seen the following number of times in the page : $count
 \n;
 

 I had modified this code in a small way as shown below and this code never
 executed to completion and it was causing 100% CPU usage on my laptop where
 it was being run.
 -
 #!/usr/bin/perl
 use warnings;
 use strict;
 use LWP::Simple;

 my $catalog = get(http://oreilly.com/store/complete.html;);

 my $count = 0;

 while ($catalog =~ /Perl/) {
$count++;
}


 print Perl was seen the following number of times in the page : $count
 \n;
 ---

 The only place where it was changed was in the pattern matching area where
 i removed the usage of all the modifiers. can some one please answer the
 following questions for me:

 1. Why is the CPU being used so much ? Is the code going in some sort of a
 loop ?
 2. Does $catalog take single string from and match for the pattern ?
In this case i am under the impression that the entire value returned by
 the get() method is stored in the $catalog variable. Please correct me if i
 am wrong.

 Appreciate your response in this regard.

 Thanks
 Jatin

 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





Re: perl code help

2010-10-25 Thread ashwin ts
Helo Saran,

The reason why it was printed in the next line is because u have no used
chomp function on $c.Chomp would remove unwanted new line characters.
I added chomp($c) to ur code and it works fine.. i mean as hw u wanted..
pls find the same code below with chomp..
###
#!/usr/bin/perl
use warnings;
use strict;

print Celsius to Fahrenheit Conversion\n;
print Enter the value of Celsius to be converted:;

my $c = STDIN;
chomp($c);
my $sf = ($c*1.8) + 32;
print $c.C is equal to , $f,F,\n
###

OUTPUT
~~

Celsius to Fahrenheit Conversion
Enter the value of Celsius to be converted:40
40C is equal to 104F


Hope this helps...

Regards
Ashwin Thayyullathil Surendran
#91 988732


On Mon, Oct 25, 2010 at 9:51 PM, saran simssa...@gmail.com wrote:

 i am new to perl. please help me with this piece of code below.
 answer wat it prints is correct but the format has to adjusted...!
 program to convert Celsius to Fahrenheit

 **
 #!/usr/bin/perl
 use warnings;
 use strict;

 print Celsius to Fahrenheit Conversion\n;
 print Enter the value of Celsius to be converted:;

 my $c = STDIN;
 my $f = ($c*1.8) + 32;
 print $c.C is equal to , $f,F,\n

 ***
 Output

 Celsius to Fahrenheit Conversion
 Enter the value of Celsius to be converted:40
 40
 C is equal to 104F
 *

 why does C is equal to 104F prints on a new line rather than 40 C
 is equal to 104F
 on a single line...
 please help


 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/