RE: install a package on windows

2010-12-15 Thread Sunita Rani Pradhan
You can install dmake/nmake to install perl packages .

-Sunita

-Original Message-
From: Erez Schatz [mailto:moonb...@gmail.com] 
Sent: Wednesday, December 15, 2010 7:47 PM
To: beginners@perl.org
Subject: Re: install a package on windows

On 12/15/2010 04:09 PM, Jeff Peng wrote:
> Hi,
> 
> I have intalled activeperl 5.10 on windows and try to install a perl
> package.

Hello Jeff,

If possible, I recommend installing from the Strawberry Perl
distribution: http://strawberryperl.com
It includes a functioning cpan client, and comes with a C compiler and a
"make" tool.

-- 
Erez

Observations, not opinions.

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



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




perl training material and excercises for freshers

2011-01-02 Thread Sunita Rani Pradhan
Hi All 

 

I am planning to give Perl training to my juniors in my
team. They are new to Perl. Could anyone please send me any Perl
training materials with exercises, or links, which I can refer to?

Please send me good suggestions also for training. 

 

Thanks & Regards

Sunita



RE: perl training material and excercises for freshers

2011-01-03 Thread Sunita Rani Pradhan
Thank you Jeff .. This site is blocked in my company , m not able to access 
files :( 

Regards
Sunita


-Original Message-
From: Jeff Pang [mailto:pa...@arcor.de] 
Sent: Monday, January 03, 2011 1:33 PM
To: Sunita Rani Pradhan
Cc: beginners@perl.org
Subject: Re: perl training material and excercises for freshers

>            I am planning to give Perl training to my juniors in my
> team. They are new to Perl. Could anyone please send me any Perl
> training materials with exercises, or links, which I can refer to?
>

Sure. There are some really good PPTs about perl training made by a
teacher Paul which was active on this list years ago. Download all the
files from:

http://home.arcor.de/pangj/tmp/AllPerlLecturePPTs.zip

Wish you like them.

Regards.

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




RE: perl training material and excercises for freshers

2011-01-03 Thread Sunita Rani Pradhan
Hi Marco 

I am not able to access this site , seems to be down . 

Regards
Sunita

-Original Message-
From: marcos rebelo [mailto:ole...@gmail.com] 
Sent: Monday, January 03, 2011 2:01 PM
To: Sunita Rani Pradhan
Cc: beginners@perl.org
Subject: Re: perl training material and excercises for freshers

I used this slides to give a Perl training 3 times.

http://www.slideshare.net/oleber/perl-introduction

The course is done in a week, supposing that your juniors know how to
program any other language.

Best luck
Marcos Rebelo

-- 
Marcos Rebelo
http://www.oleber.com/
Milan Perl Mongers leader https://sites.google.com/site/milanperlmongers/
Webmaster of http://perl5notebook.oleber.com


On Mon, Jan 3, 2011 at 8:56 AM, Sunita Rani Pradhan
 wrote:
> Hi All
>
>
>
>            I am planning to give Perl training to my juniors in my
> team. They are new to Perl. Could anyone please send me any Perl
> training materials with exercises, or links, which I can refer to?
>
> Please send me good suggestions also for training.
>
>
>
> Thanks & Regards
>
> Sunita
>
>

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




RE: perl training material and excercises for freshers

2011-01-03 Thread Sunita Rani Pradhan
I am sorry and thank you very much for help Marco . I had some issues in my 
system.

Regards
Sunita


-Original Message-
From: marcos rebelo [mailto:ole...@gmail.com] 
Sent: Monday, January 03, 2011 5:08 PM
To: Sunita Rani Pradhan
Cc: beginners@perl.org
Subject: Re: perl training material and excercises for freshers

We are speaking of slideshare.net . It's hard to believe that is down.

On Mon, Jan 3, 2011 at 12:23 PM, Sunita Rani Pradhan
 wrote:
> Hi Marco
>
>        I am not able to access this site , seems to be down .
>
> Regards
> Sunita
>
> -Original Message-
> From: marcos rebelo [mailto:ole...@gmail.com]
> Sent: Monday, January 03, 2011 2:01 PM
> To: Sunita Rani Pradhan
> Cc: beginners@perl.org
> Subject: Re: perl training material and excercises for freshers
>
> I used this slides to give a Perl training 3 times.
>
> http://www.slideshare.net/oleber/perl-introduction
>
> The course is done in a week, supposing that your juniors know how to
> program any other language.
>
> Best luck
> Marcos Rebelo
>
> --
> Marcos Rebelo
> http://www.oleber.com/
> Milan Perl Mongers leader https://sites.google.com/site/milanperlmongers/
> Webmaster of http://perl5notebook.oleber.com
>
>
> On Mon, Jan 3, 2011 at 8:56 AM, Sunita Rani Pradhan
>  wrote:
>> Hi All
>>
>>
>>
>>            I am planning to give Perl training to my juniors in my
>> team. They are new to Perl. Could anyone please send me any Perl
>> training materials with exercises, or links, which I can refer to?
>>
>> Please send me good suggestions also for training.
>>
>>
>>
>> Thanks & Regards
>>
>> Sunita
>>
>>
>



-- 
Marcos Rebelo
http://www.oleber.com/
Milan Perl Mongers leader https://sites.google.com/site/milanperlmongers/
Webmaster of http://perl5notebook.oleber.com

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



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




default arguments in subroutine

2011-01-03 Thread Sunita Rani Pradhan
Hi All

 

How can I define default arguments in Perl subroutine? Can
anybody explain with examples? 

 

Thanks

Sunita 



RE: default arguments in subroutine

2011-01-03 Thread Sunita Rani Pradhan
Thank you all for you help . I have got my answer . 

Regards
Sunita

-Original Message-
From: Michiel Beijen [mailto:michiel.bei...@gmail.com] 
Sent: Monday, January 03, 2011 9:56 PM
To: Shlomi Fish
Cc: beginners@perl.org; Sunita Rani Pradhan
Subject: Re: default arguments in subroutine

On Mon, Jan 3, 2011 at 5:04 PM, Shlomi Fish  wrote:
> Your subroutine implementation and the example do not match. Either
add {...}
> around the subroutine parameters to make it an anonymous hash
reference, or
> (less preferably IMHO) convert $param_ref to my %params = @_ (and omit
the
> ->).

:) thanks!
--
Mike

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




1st line of perl script

2011-01-03 Thread Sunita Rani Pradhan
Hi All

 

Perl script  works without the first line ( perl Interpreter
: #! /usr/bin/perl) . What is the real use of this line ? This line does
not through any error on Windows where , this path does not exist .

Why is it so ? 

 

Could anybody explain it  clearly?

 

Thanks

Sunita



RE: 1st line of perl script

2011-01-03 Thread Sunita Rani Pradhan
I think this is very good info .. I have tried on Windows and Unix as well . 
- I found like , this line does not matter on windows . Windows need .pl 
extension but Unix/Linux does not . 

- Unix required this interpreter line when we are executing as , e.g ./test.pl 
or ./test.

If the line is not given then inside script running on Unix , then need to 
execute it using perl interpreter externally .


Thank you All .

-Sunita

-Original Message-
From: alanhag...@gmail.com [mailto:alanhag...@gmail.com] On Behalf Of Alan 
Haggai Alavi
Sent: Tuesday, January 04, 2011 11:16 AM
To: Sunita Rani Pradhan
Cc: beginners@perl.org
Subject: Re: 1st line of perl script

Hi Sunita,

>            Perl script  works without the first line ( perl Interpreter
> : #! /usr/bin/perl) . What is the real use of this line ? This line does
> not through any error on Windows where , this path does not exist .

It is a shebang line which is only useful in Unix-like operating
systems. In such systems, the shebang line should start in the first
column of the first line. When such a script with its executable bit
set is run by itself, the operating systems checks for the shebang
line to see which interpreter should be used for executing the script.

However, in Windows (and other non-Unix-like operating systems), the
shebang is usually considered a comment and skipped. Instead of the
shebang line, such systems depend on file extension associations or
explicit invocation of the script using the interpreter.

For more details, see: http://en.wikipedia.org/wiki/Shebang_(Unix)

Regards,
Alan Haggai Alavi.
-- 
The difference makes the difference

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




advangtes of Perl on various languages

2011-01-03 Thread Sunita Rani Pradhan
Hi All

 

I would like to know answers of following questions  :

 

- What all advantages Perl has on top of other scripting languages like
Python , shell , Java ?

 

- What is the career growth, road map in Perl programming ?  

 

I am not sure , if this questions are right for this group mail or not ,
just asked . If it is not , please let me know which group can answer
these .



 

Thanks

Sunita

 

 



need to get parent script name inside child script

2011-01-04 Thread Sunita Rani Pradhan
Hi All

 

I work as a automation engineer in organization and I am
responsible for automation test cases in Perl .

 

My parent  automated test Perl script generally has 3 sets . 

-  1st set has pre-configurations section of test script . It is
a separate script (called prerun, common to all test cases ) , which get
called from parent test script  . 

-  2nd set is coded inside parent script , which is real test
steps .

-  3rd set has clean up section (called postrun) . This is
common to all test scripts inside one test plan tar file .  Since it is
common to all , we have put this  in another common file and called that
common file  from all parent test scripts as : do $common_cleanup or
die("$@");

 

1.   which will delete running jobs , 

2.   check server running or not and

3.   undo configuration files changes (if anything is done in any
parent test script) . We need to skip this 3rd point for those test
cases which does not have this configuration , else these tests will
fail  , for that I need parent test case name inside postrun . How can I
print parent test script name inside this postrun ? 

 

 

Please let me know if you do not understand this scenario . 

 

Thanks

Sunita



automation frameworks

2011-01-05 Thread Sunita Rani Pradhan
Hi All

 

Could you please let me know , if anybody using any automation framework
for their automation testing or any types information about automation
framework ? 

 

Note: Perl scripting should be used in that framework .

 

Thanks

Sunita



RE: advangtes of Perl on various languages

2011-01-05 Thread Sunita Rani Pradhan
Hi Peter

Please check my answers down .

Thanks
Sunita

-Original Message-
From: Peter Scott [mailto:pe...@psdt.com] 
Sent: Tuesday, January 04, 2011 1:16 PM
To: beginners@perl.org
Subject: Re: advangtes of Perl on various languages

On Tue, 04 Jan 2011 12:42:28 +0530, Sunita Rani Pradhan wrote:
> I would like to know answers of following questions  :
>  
> - What all advantages Perl has on top of other scripting languages
like
> Python , shell , Java ?
>  
> - What is the career growth, road map in Perl programming ?

These questions are more of a Rohrshach test for the reader than
anything 
else.  Without any idea of what goal you are trying to satisfy any
answer 
is essentially useless.  It is like the old saw that a recession is when

the other guy is out of work and a depression is when you are out of
work: 
aggregate statistics--and industry trends--are of very little importance

compared to your personal priorities.

If you want a language with a large install base, learn COBOL.  If you 
want cool IDEs, learn Java.  Me, I don't care whether there's more money

in Java, it wouldn't be enough for me.  And if money's the top priority,

become a lawyer.

So I can't see any answers to those questions being of use unless you
tell 
us why you want to know.  Are they an assignment for a term paper?  Are 
you writing a trade magazine article?  Or something else?  If you're 
asking in regard to your own career path then we'd need to know a lot
more 
about what your priorities and background are.

>>> This is a good question .I am asking for my own career growth . I
work as a automation engineer . I used to be in manual testing and moved
to automation just been 1.5yr. 
-- 
Peter Scott
http://www.perlmedic.com/ http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274
http://www.oreillyschool.com/courses/perl3/

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



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




RE: 1st line of perl script

2011-01-10 Thread Sunita Rani Pradhan
We have -w option for warnings  which we specify with the 1st line . How
does it work on windows ?

-Sunita

-Original Message-
From: Donald Calloway [mailto:donald.callo...@gmail.com] 
Sent: Sunday, January 09, 2011 6:42 PM
To: beginners@perl.org
Subject: Re: 1st line of perl script

I think there is no error thrown by Windows (or any other architecture)

because this line is never compiled because of the # in front which  
signifies the line as comments.

On Tue, 04 Jan 2011 00:33:18 -0500, Sunita Rani Pradhan  
 wrote:

> Hi All
>
>
> Perl script  works without the first line ( perl
Interpreter
> : #! /usr/bin/perl) . What is the real use of this line ? This line
does
> not through any error on Windows where , this path does not exist .
>
> Why is it so ?
>
>
> Could anybody explain it  clearly?
>
>
> Thanks
>
> Sunita
>


-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



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




RE: 1st line of perl script

2011-01-10 Thread Sunita Rani Pradhan
Yes I can use that . Does this -w option works on windows or not ?

-Original Message-
From: Christian Marquardt [mailto:christian.marqua...@trivadis.com] 
Sent: Monday, January 10, 2011 6:22 PM
To: Sunita Rani Pradhan; Donald Calloway; beginners@perl.org
Subject: Re: 1st line of perl script

Maybe you can use "use warnings;" for this ...

Best regards
Christian




Am 10.01.11 13:49 schrieb "Sunita Rani Pradhan" unter
:

>We have -w option for warnings  which we specify with the 1st line .
How
>does it work on windows ?
>
>-Sunita
>
>-Original Message-
>From: Donald Calloway [mailto:donald.callo...@gmail.com]
>Sent: Sunday, January 09, 2011 6:42 PM
>To: beginners@perl.org
>Subject: Re: 1st line of perl script
>
>I think there is no error thrown by Windows (or any other architecture)
>
>because this line is never compiled because of the # in front which
>signifies the line as comments.
>
>On Tue, 04 Jan 2011 00:33:18 -0500, Sunita Rani Pradhan
> wrote:
>
>> Hi All
>>
>>
>> Perl script  works without the first line ( perl
>Interpreter
>> : #! /usr/bin/perl) . What is the real use of this line ? This line
>does
>> not through any error on Windows where , this path does not exist .
>>
>> Why is it so ?
>>
>>
>> Could anybody explain it  clearly?
>>
>>
>> Thanks
>>
>> Sunita
>>
>
>
>-- 
>Using Opera's revolutionary email client: http://www.opera.com/mail/
>
>-- 
>To unsubscribe, e-mail: beginners-unsubscr...@perl.org
>For additional commands, e-mail: beginners-h...@perl.org
>http://learn.perl.org/
>
>
>
>-- 
>To unsubscribe, e-mail: beginners-unsubscr...@perl.org
>For additional commands, e-mail: beginners-h...@perl.org
>http://learn.perl.org/
>
>


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




RE: 1st line of perl script

2011-01-10 Thread Sunita Rani Pradhan
Yes I agree . Then I am coming back to my 1st question . This path does not 
exist on windows "/usr/bin/perl " , how it works ?


Thanks
Sunita

-Original Message-
From: Brandon McCaig [mailto:bamcc...@gmail.com] 
Sent: Monday, January 10, 2011 9:14 PM
To: Shawn H Corey
Cc: beginners@perl.org
Subject: Re: 1st line of perl script

On Mon, Jan 10, 2011 at 10:32 AM, Shawn H Corey  wrote:
> I do believe so but if you `use warnings;` you can turn it off.  You can't
> do that with -w.

I just tested with Strawberry Perl v5.12.1 in Windows XP with the
following code:

#!/usr/bin/perl -w

my @a;
my $b = @a[0];

__END__

When run, I get:

Scalar value @a[0] better written as $a[0] at test.pl line 4.

So yes, it does seem to work, but I think that 'use warnings;' is best
practice anyway, as Shawn pointed out.

-- 
Brandon McCaig  
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software  

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



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




RE: 1st line of perl script

2011-01-10 Thread Sunita Rani Pradhan

On Mon, Jan 10, 2011 at 11:21 AM, Shawn H Corey 
wrote:
> It isn't used if you start your scripts from Windows.

It worked for me earlier:

On Mon, Jan 10, 2011 at 10:43 AM, Brandon McCaig 
wrote:
> I just tested with Strawberry Perl v5.12.1 in Windows XP with the
> following code:
>
> #!/usr/bin/perl -w
>
> my @a;
> my $b = @a[0];
>
> __END__
>
> When run, I get:
>
> Scalar value @a[0] better written as $a[0] at test.pl line 4.

Invoked like: perl test.pl

>> Invoking like this , you are specifying perl interpreter , is not it?
Then why do we need 1st line ? Only test.pl also run this program .

If I remove the -w from the shebang line then no warning is output.
Unless I'm misunderstanding you...

-- 
Brandon McCaig  
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software 


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



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




doubt in substring

2011-01-12 Thread Sunita Rani Pradhan
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



Perl OOP concept in real time scenario

2011-01-13 Thread Sunita Rani Pradhan
Hi All

 

Can anyone explain the Perl OOP concept with one real time
example ? How it is useful or required in our programming life? Any link
also would be helpful . 

 

Thanks

Sunita



RE: Perl OOP concept in real time scenario

2011-01-13 Thread Sunita Rani Pradhan
Hi Shlomi

Thanks for your help . I meant that , in what kind of scenario
we should use OOP features(in perl) ? 

Thanks
Sunita 

-Original Message-
From: Shlomi Fish [mailto:shlo...@iglu.org.il] 
Sent: Thursday, January 13, 2011 6:22 PM
To: beginners@perl.org
Cc: Sunita Rani Pradhan
Subject: Re: Perl OOP concept in real time scenario

Hi Sunita,

On Thursday 13 Jan 2011 11:46:38 Sunita Rani Pradhan wrote:
> Hi All
> 
> 
> 
> Can anyone explain the Perl OOP concept with one real time
> example ? How it is useful or required in our programming life? Any
link
> also would be helpful .

First of all, note that I don't understand what you mean by "real time".
Real 
time in computing normally means that:

http://en.wikipedia.org/wiki/Real-time_computing

Otherwise, I give the motivation for OOP and other paradigms here:

http://perl-begin.org/tutorials/perl-for-newbies/part3/

You should read the introduction, but note that the rest of the tutorial
has 
become baroque in time, and you should see this instead:

http://perl-begin.org/topics/object-oriented/

For some examples of object-oriented code in Perl, you may wish to
consult my 
CPAN directory ( http://search.cpan.org/~shlomif/ ) and other modules on
CPAN:

Best regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Chuck Norris/etc. Facts - http://www.shlomifish.org/humour/bits/facts/

Chuck Norris can make the statement "This statement is false" a true
one.

Please reply to list if it's a mailing list post - http://shlom.in/reply
.

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




RE: Windows 7 64 bit Make.exe file

2011-01-19 Thread Sunita Rani Pradhan
Could you please tell me about this Strawberry ? 

Thanks
Sunita

-Original Message-
From: Sean Murphy [mailto:mhysnm1...@gmail.com] 
Sent: Wednesday, January 19, 2011 3:06 PM
To: Sisyphus; beginners@perl.org
Subject: Re: Windows 7 64 bit Make.exe file

Hi guys,

thanks. I have removed Active PERL and now are using strawberry to do my

work. No problems with Strawberry and I can get rid of the MS C++
Express 
2010 compiler.


Sean
- Original Message - 
From: "Sisyphus" 
To: "Sean Murphy" ; 
Sent: Wednesday, January 19, 2011 3:52 PM
Subject: Re: Windows 7 64 bit Make.exe file


>
> - Original Message - 
> From: "Sean Murphy" 
> To: 
> Sent: Tuesday, January 18, 2011 9:23 PM
> Subject: Windows 7 64 bit Make.exe file
>
>
> Hi all.
>
> I cannot install any CPAN libraries because CPAN complains that I
don't 
> have a 64 bit Make executible. I have installed the Express 2010 C++ 
> package from Microsoft. It didn't help.
>
> =
>
> If you have ActivePerl, CPAN will be wanting to find nmake.exe - and I

> would think nmake.exe would be part of the compiler package you
installed.
>
> Having installed that compiler, you then usually need to run a batch
file 
> (from the command line) prior to using it. That batch file (which
ships 
> with the compiler) will alter the environment so that things like 
> nmake.exe, cl.exe and the various libraries and headers *do* get
found.
> Only thing is, I don't know exactly what the batch file is called -
maybe 
> vcvarsall.bat or vcvars64.bat or vsvars64.bat or something like that
... 
> See if you can find it and give it a try.
>
> The ideal MS compiler to use with x64 ActivePerl builds is the
"Microsoft 
> Platform SDK for Windows Server 2003 R2", as that's the compiler used
to 
> build x64 ActivePerl. It's still freely available for download from 
> Microsoft, but a bit tricky to get hold of - if you're not careful the

> "Microsoft Platform SDK for Windows Server 2003 R2" download links
that 
> you follow morph into links that give you an updated version of that 
> compiler. (But it can be done if you find the right links.)
>
> For x64 Windows perl builds especially, Strawberry Perl is a simpler 
> proposition when it comes to installing modules using CPAN. (It uses
the 
> dmake make utility, and the mingw-w64.sf port of the gcc compiler.)
>
> Cheers,
> Rob
> 


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



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




string index fucntion

2011-01-26 Thread Sunita Rani Pradhan
Hi All

 

There is a sting as : "The cat is sat on the mat" .

I want  to get index of  second occurrence of"at" using index
function . Can it be  possible?  

 

Thanks

Sunita



RE: string index fucntion

2011-01-26 Thread Sunita Rani Pradhan
I think , this is like : index( $string, 'at', index( $string, 'at' ) +
1); Please let me know , if I am wrong.

Thanks
Sunita

-Original Message-
From: Shawn H Corey [mailto:shawnhco...@gmail.com] 
Sent: Wednesday, January 26, 2011 10:44 PM
To: beginners@perl.org
Subject: Re: string index fucntion

On 11-01-26 11:53 AM, Sunita Rani Pradhan wrote:
>  There is a sting as : "The cat is sat on the mat" .
>
> I want  to get index of  second occurrence of"at" using index
> function . Can it be  possible?

Yes.

my $second_at = index( $string, 'at', index( $string, 'at' ));


-- 
Just my 0.0002 million dollars worth,
   Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

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



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




RE: Read and change the file

2011-03-17 Thread Sunita Rani Pradhan
Hi Wisma

You can try following set of code :
--
#!/usr/local/bin/perl -w

use warnings;


open (DATA , "data.txt") or die "can not open data.txt, $!";

open (DATA1, ">data1.txt") or die "can not open data1.txt, $!";

while(){


$string = $_;
 
($data1,$data2) = $string =~ /(Data \w)\s+(.*)/;

$data2 = join (",",split(/\s+/,$data2));

$string = "$data1 = ($data2);\n";


print DATA1 $string;

}

close DATA;
close DATA1;


Thanks
Sunita

-Original Message-
From: wisma laili [mailto:wsmla...@yahoo.com] 
Sent: Thursday, March 17, 2011 2:54 PM
To: beginners@perl.org
Subject: Read and change the file

Hi Guys!

I am newbie in Perl.

I have problem in reading a file and change it to get some specific
output. For 
example : I want to read a file : filename.txt which contain  2 lines:
Data A 1 2 3 4 5  
Data B 6 7 8 9 10 
the name of the data and the values are tab separated.  my wish is to
change it 
into :Data A = (1,2,3,4,5); Data B = (6,7,8,9,10); 

Thanks in advanced for your kindly help!

Regards,
-student-


  

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




RE: sub routine

2011-03-18 Thread Sunita Rani Pradhan
Hi Christ 
   
 In sub Dist() , you need define scope of each variable as my or our or 
local , which is line no.20 . 

Regards
Sunita

-Original Message-
From: Chris Stinemetz [mailto:cstinem...@cricketcommunications.com] 
Sent: Friday, March 18, 2011 9:18 PM
To: Uri Guttman
Cc: beginners
Subject: RE: sub routine

Thanks Uri.

I've been reading perldoc perlsub and have a better understanding about 
subroutines, but I am still stuck. Any help is greatly appreciated.

The error I am getting is:

Global symbol "%record" requires explicit package name at ./DOband1.pl line 20.
Global symbol "$line" requires explicit package name at ./DOband1.pl line 20.
Global symbol "%record" requires explicit package name at ./DOband1.pl line 21.
syntax error at ./DOband1.pl line 21, near "$record{dist"
Global symbol "%record" requires explicit package name at ./DOband1.pl line 22.
syntax error at ./DOband1.pl line 22, near "data["
Global symbol "%record" requires explicit package name at ./DOband1.pl line 24.
syntax error at ./DOband1.pl line 25, near "}"
Execution of ./DOband1.pl aborted due to compilation errors.

#!/usr/bin/perl

use warnings;
use strict;

use File::Slurp;

my $filepath = 'C:/temp/PCMD';
my $output  = 'output.txt';

my %cols = (
cell => 31,
sect => 32,
chan => 38,
dist => 261,
précis => 262,
);

sub Dist{
@record{ keys %cols } = (split /;/, $line)[ values %cols ] ;
foreach $record{dist} {
$record{dist} = ((data[261]+13)/6.6/8/2*10)/10 ;
}
return $record{dist};
}

my @records;

my @lines = read_file( $filepath );

chomp @lines;

foreach my $line ( @lines ) {

next unless $line =~ /;/;

my %record;

# this gets just what you want into a hash using a hash slice and an # array 
slice. 
# the order of keys and values will be the same for any # given hash

@record{ keys %cols } = (split /;/, $line)[ values %cols ] ;

$record{carr} = ( $record{chan} == 15 ) ? 2 : 1 ;   
$record{dist} = ( length( $record{dist}) > 1 ) ? getDist() : '' ;

push( @records, my $record ) ;
}

my @sorted = sort {
$a->{cell} <=> $b->{cell} ||
$a->{sect} <=> $b->{sect} ||
$a->{carr} <=> $b->{carr}
} @records ;


my @report = map "@{$_{ keys %cols }}\n", @records ;

print @report ;
write_file($output, @report) ;

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




assigning hash to a scalar

2011-03-26 Thread Sunita Rani Pradhan
Hi All

 

I have following set of code (just assign a hash to a scalar) :

 

chomp($input = );

%input = split (/\s+/,$input);

$var = %input;

Print "value: : $var\n";

 

 

Input : orange 12 apple 23 pinnaple 78

Output : 3/8--> What does this output  mean ?

 

 

Thanks

Sunita



RE: assigning hash to a scalar

2011-03-26 Thread Sunita Rani Pradhan
Thanks Alan . I had got this piece of info from google but I do not
understand clearly what it wants to define . It would be good  , if you
can explain bit more .

Regards
Sunita

-Original Message-
From: Alan Haggai Alavi [mailto:alanhag...@alanhaggai.org] 
Sent: Saturday, March 26, 2011 1:19 PM
To: Sunita Rani Pradhan
Cc: beginners@perl.org
Subject: Re: assigning hash to a scalar

Hi Sunita,

> $var = %input;
> ...
> Output : 3/8-->  What does this output  mean ?
You are evaluating a hash in a scalar context.

Quoting perldata:

If you evaluate a hash in scalar context, it returns false if the hash
is empty.  If there are any key/value pairs, it returns true; more
precisely, the value returned is a string consisting of the number of
used buckets and the number of allocated buckets, separated by a slash.
  This is pretty much useful only to find out whether Perl's internal
hashing algorithm is performing poorly on your data set.  For example,
you stick 10,000 things in a hash, but evaluating %HASH in scalar
context reveals "1/16", which means only one out of sixteen buckets has
been touched, and presumably contains all 10,000 of your items.  This
isn't supposed to happen.  If a tied hash is evaluated in scalar
context, a fatal error will result, since this bucket usage information
is currently not available for tied hashes.

Regards,
Alan Haggai Alavi.
-- 
The difference makes the difference

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




RE: Capturing the output of a shell command

2011-04-05 Thread Sunita Rani Pradhan
Hi Anjan

You can execute shell command inside "``" and capture the output in
variable . e,g:
--
$, = " ";
$ls = `ls`;
print $ls;
@ls = split(/\n/,$ls);
print @ls;
--

Thanks
Sunita


-Original Message-
From: ANJAN PURKAYASTHA [mailto:anjan.purkayas...@gmail.com] 
Sent: Tuesday, April 05, 2011 6:54 PM
To: Perl Beginners
Subject: Capturing the output of a shell command

Hi,
Is there any way to run a shell command from within a perl script and
capture the output in, say, an array?
One can run a shell command through the system function. But system
itself
just returns a status code.

-- 
===
Anjan Purkayastha, PhD
Senior Computational Biologist
TessArae LLC
46090 Lake Center Plaza, Suite 304
Potomac Falls, VA 20165**
Office- 703.444.7188 ext. 116
Mobile-703.740.6939
===

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




regular expression for email id and IP address

2011-04-09 Thread Sunita Rani Pradhan
Hi All

 

 

1. Can anybody guide me to write a regular expression to
verify correct Email address ?



2. I have written a regular expression to verify correct IP address : 

 

print $ipadd if ($ipadd =~
/^([0-9])|([1-9][0-9])|([1-2][0-5][0-5])\.([0-9])|([1-9][0-9])|([1-2][0-
5][0-5])\.([0-9])|([1-9][0-9])|([1-2][0-5][0-5])\.([0-9])|([1-9][0-9])|(
[1-2][0-5][0-5])/);

 

It is working as per my input . Please let me know if it correct or not
. 

 

Thanks

Sunita



RE: regular expression for email id and IP address

2011-04-09 Thread Sunita Rani Pradhan
Yes it is matching 167.249.0.0 .

-Sunita
-Original Message-
From: Jim Gibson [mailto:jimsgib...@gmail.com] 
Sent: Saturday, April 09, 2011 11:50 PM
To: Perl Beginners
Subject: Re: regular expression for email id and IP address

At 11:42 PM +0530 4/9/11, Sunita Rani Pradhan wrote:
>Hi All
>
>
>
>
>
> 1. Can anybody guide me to write a regular expression to
>verify correct Email address ?


peldoc -q valid "How do I check a valid mail address?"


>
>
>
>2. I have written a regular expression to verify correct IP address :
>
>
>
>print $ipadd if ($ipadd =~
>/^([0-9])|([1-9][0-9])|([1-2][0-5][0-5])\.([0-9])|([1-9][0-9])|([1-2][0
-
>5][0-5])\.([0-9])|([1-9][0-9])|([1-2][0-5][0-5])\.([0-9])|([1-9][0-9])|
(
>[1-2][0-5][0-5])/);
>
>
>
>It is working as per my input . Please let me know if it correct or not
>.


I don't believe it is correct. Does it match 167.249.0.0?

-- 
Jim Gibson
j...@gibson.org

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



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




RE: regular expression for email id and IP address

2011-04-09 Thread Sunita Rani Pradhan
Hi Johan

You are right. Thanks for pointing out  . Can you help me
getting it correct ? 

Thanks
Sunita

-Original Message-
From: Olof Johansson [mailto:o...@ethup.se] 
Sent: Sunday, April 10, 2011 12:13 AM
To: beginners@perl.org
Subject: Re: regular expression for email id and IP address

On 2011-04-09 23:53 +0530, Sunita Rani Pradhan wrote:
> Yes it is matching 167.249.0.0 .

But it's also matching things like "42". Feature? 

Read about quantifiers, and also about the precedence of |.

-- 
- Olof Johansson
-  www:  http://www.stdlib.se/
-  {mail,xmpp}:  o...@ethup.se
-  irc:  zibri on Freenode/OFTC/IRCnet/...
--

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




issue wit sysopen

2011-04-10 Thread Sunita Rani Pradhan
Hi All

 

I have following simple code :

 

===

use warnings;

 

sysopen(DATA,"list1.txt",O_RDWR|O_TRUNC);

 

@array1=;

 

 

foreach $i (@array1){

 

$i =~ s/d|b/G/ig;

print DATA $i;

}

 

close DATA;

---

 

 

It is failing with following error : Argument "O_VVW^C" isn't numeric in
sysopen at sysopen.pl line 3.

 

I am not able to find the cause of this issue. Could anybody let me know
, where I am wrong ? 

 

 

Thanks

Sunita



RE: writing to output using filehandles

2011-04-12 Thread Sunita Rani Pradhan
Hi Mark

You have opened OUTFILE (OUTFILE, "<$output" ) in read mode . To
write to this file you need to open in write mode (">$output").

Sunita

-Original Message-
From: mark baumeister [mailto:mlfmp...@gmail.com] 
Sent: Tuesday, April 12, 2011 6:18 AM
To: beginners@perl.org
Subject: writing to output using filehandles

Hi I am having trouble with my search and replace code in the program
below.
I can sucessfully copy the input file to the output file but
my search and replace is not working.  Any hints on what I am doing
wrong?
Thanks,
M


#!/usr/bin/perl -w
use strict;

my $input;
my $output;
my $search;
my $replace;

print "enter an input file name:\n";
$input = ;
chomp($input);

print "enter an output file name:\n";
$output = ;
chomp($output);


print "enter a search pattern:\n";
$search = ;
chomp($search);

print "enter a replacement string:\n";
$replace = ;
chomp($replace);

open INFILE, "<$input" or die "Can't open $input ($!)";
open OUTFILE, "<$output" or die "Can't open $output ($!)";

while () {
s/$search/$replace/g;
print OUTFILE $_;
}


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



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