Re: function alias

2019-09-04 Thread Paul Johnson
On Wed, Sep 04, 2019 at 02:17:36PM +0800, Wesley Peng via beginners wrote: > Hello, This is actually two different questions with two different answers: > How to make a function alias in perl? $ perl -E 'sub b { say 67 } *says = \&b; says(83)' 67 $ > for ex

Re: function alias

2019-09-04 Thread Andy Bach
As an aside, Perl 5.10 and up, you can get the "say" command by enabling extended functions: perl -E 'say "hi mom" ' hi mom\n https://perlmaven.com/what-is-new-in-perl-5.10--say-defined-or-state a On Wed, Sep 4, 2019 at 1:08 PM Andy Bach wrote: > > > for example, says() is alias to print(). > >

Re: function alias

2019-09-04 Thread Andy Bach
> for example, says() is alias to print(). sub says { print "$_\n" foreach @_; } On Wed, Sep 4, 2019 at 1:17 AM Wesley Peng via beginners wrote: > > Hello, > > How to make a function alias in perl? for example, says() is alias to > print(). > > thanks. > > -- > To unsubscribe, e-mail: begin

Re: function alias

2019-09-04 Thread Hao Wu
https://stackoverflow.com/questions/4512094/aliasing-a-function-in-perl On Wed, Sep 4, 2019 at 2:17 PM Wesley Peng via beginners wrote: > Hello, > > How to make a function alias in perl? for example, says() is alias to > print(). > > thanks. > > -- > To unsubscribe, e-mail: beginners-unsubscr...

Re: Function to print Object properties

2011-01-07 Thread Alan Haggai Alavi
Hi Parag, On Friday 07 January 2011 07:55:38 Parag Kalra wrote: > Anyways I want to know is there any function or a way that would > reveal all the properties of the object. Introspect the symbol table hash (stash): use strict; use warnings; use Data::Dumper; use Foo::Bar; my $fob = Foo::Bar->

Re: Function to print Object properties

2011-01-06 Thread Peter Scott
On Thu, 06 Jan 2011 21:31:11 -0500, Shawn H Corey wrote: > On 11-01-06 09:25 PM, Parag Kalra wrote: >> For example if I have a package say Foo::Bar. Now assume that there is >> a object called $fob and pretend that I don't know that its an instance >> of Foo::Bar > > print ref( $fob ), "\n"; > >

Re: Function to print Object properties

2011-01-06 Thread Parag Kalra
Awesome. Thanks Alan and Shawn Cheers, Parag On Thu, Jan 6, 2011 at 6:52 PM, Alan Haggai Alavi wrote: > Hi Parag, > > On Friday 07 January 2011 07:55:38 Parag Kalra wrote: >> Anyways I want to know is there any function or a way that would >> reveal all the properties of the object. > > Intr

Re: Function to print Object properties

2011-01-06 Thread Shawn H Corey
On 11-01-06 09:46 PM, Parag Kalra wrote: Thanks it worked.:) Cheers, Parag You can also print the whole thing out with Data::Dumper use Data::Dumper; if( ref( $fob ) ){ print '$fob ', Dumper $fob; } -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of under

Re: Function to print Object properties

2011-01-06 Thread Parag Kalra
Thanks it worked. :) Cheers, Parag On Thu, Jan 6, 2011 at 6:31 PM, Shawn H Corey wrote: > On 11-01-06 09:25 PM, Parag Kalra wrote: >> >> For example if I have a package say Foo::Bar. Now assume that there is >> a object called $fob and pretend that I don't know that its an >> instance of Foo::

Re: Function to print Object properties

2011-01-06 Thread Shawn H Corey
On 11-01-06 09:25 PM, Parag Kalra wrote: For example if I have a package say Foo::Bar. Now assume that there is a object called $fob and pretend that I don't know that its an instance of Foo::Bar print ref( $fob ), "\n"; See `perldoc -f ref`. -- Just my 0.0002 million dollars worth, Sh

Re: function return

2010-04-30 Thread Shawn H Corey
C.DeRykus wrote: Um, that won't do what you think. The () just tosses all the return arg's and $name remains undefined because of the list context. my($name) = () = Function1($arg); # $name stays undef If $name were in scalar context though, you'd get a count of the arg's returned and thrown

Re: function return

2010-04-30 Thread Akhthar Parvez K
On Thursday 29 Apr 2010, C.DeRykus wrote: > Um, that won't do what you think. The () just tosses all > the return arg's and $name remains undefined because > of the list context. > >   my($name) = () = Function1($arg);  # $name stays undef > > If $name were in scalar context though, you'd get a c

Re: function return

2010-04-30 Thread C.DeRykus
On Apr 29, 4:57 am, shawnhco...@gmail.com (Shawn H Corey) wrote: > Akhthar Parvez K wrote: > > Hi, > > > The following line stores the first return value by the function Function1 > > to the variable $name: > > > my ($name) = @_[0] = &Function1 ($arg); > > > but this one doesn't work: > > my ($nam

Re: function return

2010-04-29 Thread Shlomi Fish
On Thursday 29 Apr 2010 20:57:18 Akhthar Parvez K wrote: > On Thursday 29 Apr 2010, Shlomi Fish wrote: > > Just do: > > > > my ($name) = Function1 ($arg); > > > > This will evaluate Function1 in list context (instead of scalar or void > > context) and only get the first element. But the @_ of a f

Re: function return

2010-04-29 Thread Shlomi Fish
Hi all, On Thursday 29 Apr 2010 19:35:52 Shawn H Corey wrote: > Akhthar Parvez K wrote: > > On Thursday 29 Apr 2010, Shlomi Fish wrote: > >> Why are you assigning to variables inside @_? It's almost always a bad > >> idea. > >> > >> @_ is the function parameters' list. You should read the values

Re: function return

2010-04-29 Thread John W. Krahn
Akhthar Parvez K wrote: On Thursday 29 Apr 2010, Shlomi Fish wrote: Why are you assigning to variables inside @_? It's almost always a bad idea. @_ is the function parameters' list. You should read the values from there (using "my ($param1, $param2, $param3) = @_;" or "my $param1 = shift;" (sh

Re: function return

2010-04-29 Thread Akhthar Parvez K
On Thursday 29 Apr 2010, Shlomi Fish wrote: > Just do: > > my ($name) = Function1 ($arg); > > This will evaluate Function1 in list context (instead of scalar or void > context) and only get the first element. But the @_ of a function is not > affected by calls to other functions inside it. Cor

Re: function return

2010-04-29 Thread Shlomi Fish
On Thursday 29 Apr 2010 19:25:05 Akhthar Parvez K wrote: > On Thursday 29 Apr 2010, Shlomi Fish wrote: > > Why are you assigning to variables inside @_? It's almost always a bad > > idea. > > > > @_ is the function parameters' list. You should read the values from > > there (using "my ($param1, $p

Re: function return

2010-04-29 Thread Shawn H Corey
Akhthar Parvez K wrote: On Thursday 29 Apr 2010, Shlomi Fish wrote: Why are you assigning to variables inside @_? It's almost always a bad idea. @_ is the function parameters' list. You should read the values from there (using "my ($param1, $param2, $param3) = @_;" or "my $param1 = shift;" (sh

Re: function return

2010-04-29 Thread Akhthar Parvez K
On Thursday 29 Apr 2010, Shlomi Fish wrote: > Why are you assigning to variables inside @_? It's almost always a bad idea. > > @_ is the function parameters' list. You should read the values from there > (using "my ($param1, $param2, $param3) = @_;" or "my $param1 = shift;" (short > for "shift(@

Re: function return

2010-04-29 Thread Shlomi Fish
On Thursday 29 Apr 2010 14:31:38 Akhthar Parvez K wrote: > Hi, > > The following line stores the first return value by the function Function1 > to the variable $name: > > my ($name) = @_[0] = &Function1 ($arg); > Why are you assigning to variables inside @_? It's almost always a bad idea. @_ i

Re: function return

2010-04-29 Thread John W. Krahn
Akhthar Parvez K wrote: Hi, Hello, The following line stores the first return value by the function Function1 to the variable $name: my ($name) = @_[0] = &Function1 ($arg); The array slice @_[0] forces list context on the right side of the assignment but warns. $name in parentheses forc

Re: function return

2010-04-29 Thread Shawn H Corey
Akhthar Parvez K wrote: Hi, The following line stores the first return value by the function Function1 to the variable $name: my ($name) = @_[0] = &Function1 ($arg); but this one doesn't work: my ($name) = $_[0] = &Function1 ($arg); Eventhough I've no issues to use the first one as long as i

Re: function umask() and problem in GD::image->png

2010-03-31 Thread Shlomi Fish
Wednesday, March 31, 2010 5:18 PM > To: beginners@perl.org > Cc: CHAN, KENNETH 1 [AG/7721] > Subject: Re: function umask() and problem in GD::image->png > > Hi Kenneth, > > On Wednesday 31 Mar 2010 11:34:37 CHAN, KENNETH 1 [AG/7721] wrote: > > Hi all, > > &

RE: function umask() and problem in GD::image->png

2010-03-31 Thread CHAN, KENNETH 1 [AG/7721]
urces on how to do it? Or can I only reinstall the GD distribution and how? Thanks heaps. Regards, Kenneth -Original Message- From: Shlomi Fish [mailto:shlo...@iglu.org.il] Sent: Wednesday, March 31, 2010 5:18 PM To: beginners@perl.org Cc: CHAN, KENNETH 1 [AG/7721] Subject: Re: fun

Re: function umask() and problem in GD::image->png

2010-03-31 Thread John W. Krahn
CHAN, KENNETH 1 [AG/7721] wrote: Hi all, Hello, I have 2 simple questions (maybe be very trial): 1. I saw some code put "umask 022;" in the near beginning of perl script. I understand that umask is for changing the file permission in unix/linux. No, that is incorrect. umask() by itself d

Re: function umask() and problem in GD::image->png

2010-03-31 Thread Shlomi Fish
Hi Kenneth, On Wednesday 31 Mar 2010 11:34:37 CHAN, KENNETH 1 [AG/7721] wrote: > Hi all, > I have 2 simple questions (maybe be very trial): > 1. I saw some code put "umask 022;" in the near beginning of perl > script. I understand that umask is for changing the file permission in > unix/linux. H

Re: function calling and object calling

2009-08-11 Thread Uri Guttman
> "JG" == Jenn G writes: JG> On Tue, Aug 11, 2009 at 2:33 PM, Uri Guttman wrote: >>> "JG" == Jenn G writes: >> >>  JG> When I create a package, and call its methods by both object way and >>  JG> function (exported) way, how to avoid the conflict in arguments >>  JG> passing

Re: function calling and object calling

2009-08-11 Thread Chas. Owens
On Tue, Aug 11, 2009 at 05:45, Jenn G. wrote: > On Tue, Aug 11, 2009 at 2:33 PM, Uri Guttman wrote: >>> "JG" == Jenn G writes: >> >>  JG> When I create a package, and call its methods by both object way and >>  JG> function (exported) way, how to avoid the conflict in arguments >>  JG> passing

Re: function calling and object calling

2009-08-11 Thread Jenn G.
On Tue, Aug 11, 2009 at 2:33 PM, Uri Guttman wrote: >> "JG" == Jenn G writes: > >  JG> When I create a package, and call its methods by both object way and >  JG> function (exported) way, how to avoid the conflict in arguments >  JG> passing? > > why are you trying to do OO and procedural call

Re: function calling and object calling

2009-08-10 Thread Chas. Owens
On Tue, Aug 11, 2009 at 02:14, Jenn G. wrote: > Hello, > > When I create a package, and call its methods by both object way and > function (exported) way, how to avoid the conflict in arguments > passing? snip Short answer: don't do that. Medium answer: Mixing procedural and OO style in the same

Re: function calling and object calling

2009-08-10 Thread Uri Guttman
> "JG" == Jenn G writes: JG> When I create a package, and call its methods by both object way and JG> function (exported) way, how to avoid the conflict in arguments JG> passing? why are you trying to do OO and procedural calls on the same subs? it makes no sense. how will a procedural

Re: Function Assistance Needed

2009-05-11 Thread Randal L. Schwartz
> "AndrewMcHorney" == AndrewMcHorney writes: AndrewMcHorney> I need a little assistance in creating a function for my perl AndrewMcHorney> code. The function will pass in an array of strings and an AndrewMcHorney> index. The function will build a single string using the 1st AndrewMcHorney> s

Re: Function Assistance Needed

2009-05-10 Thread Chas. Owens
On Sun, May 10, 2009 at 13:06, AndrewMcHorney wrote: > Hello > > I need a little assistance in creating a function for my perl code. The > function will pass in an array of strings and an index. The function will > build a single string using the 1st string at the passed in index and the > remaini

Re: function call

2008-12-30 Thread John W. Krahn
David Ehresmann wrote: List, Hello, I have a factorial script that calls a sub fact that does the factorial and returns a value. But I get this error when I execute the script: Use of uninitialized value in numeric gt (>) at fact.pl line 22. Here is the script: #!/usr/bin/perl use warnin

Re: function call

2008-12-30 Thread Chas. Owens
On Tue, Dec 30, 2008 at 10:08, David Ehresmann wrote: > this works, thanks. I thought you had to declare the function before > you called it? That is not right? snip No, but there are some benefits to doing so. For instance, if you don't use parenthesis with calls to functions perl hasn't seen

Re: function call

2008-12-30 Thread Mr. Shawn H. Corey
On Tue, 2008-12-30 at 09:08 -0600, David Ehresmann wrote: > this works, thanks. I thought you had to declare the function before > you called it? That is not right? No, when you execute a Perl script, it is compiled before it is run. Therefore all subs are known before the script is run; they are

Re: function call

2008-12-30 Thread Jenda Krynicky
From: "Mr. Shawn H. Corey" > On Tue, 2008-12-30 at 07:10 -0600, David Ehresmann wrote: > > fact(); > > This calls the sub with an undef arguement. Just delete this line. No. It calls the sub with no arguments. fact(undef); would call it with an undef argument. > > my $num; > > > > print "e

Re: function call

2008-12-30 Thread David Ehresmann
this works, thanks. I thought you had to declare the function before you called it? That is not right? #!/usr/bin/perl use warnings; use strict; my $num; print "enter a number: \n"; chomp($num = ); my $x = fact($num); print "the factorial is: $x\n"; sub fact { my $num = shift @_;

Re: function call

2008-12-30 Thread Mr. Shawn H. Corey
On Tue, 2008-12-30 at 07:10 -0600, David Ehresmann wrote: > I have a factorial script that calls a sub fact that does the > factorial and returns a value. But I get this error when I execute > the script: > > Use of uninitialized value in numeric gt (>) at fact.pl line 22. > > Here is the script

Re: function is executing or not

2008-12-15 Thread Jenda Krynicky
From: > I have several subroutines/functions in Perl script. I just wanted to > know how to check whether specific function/subroutine in my Perl script > is really executing or not. And if it is executing then what is the exit > status of that function. Have a look at http://search.cpan.org/~p

Re: function is executing or not

2008-12-12 Thread Raymond Wan
Hi Irfan, irfan.sa...@cognizant.com wrote: I have several subroutines/functions in Perl script. I just wanted to know how to check whether specific function/subroutine in my Perl script is really executing or not. And if it is executing then what is the exit status of that function. Can

Re: function call help

2008-07-09 Thread Rob Dixon
[EMAIL PROTECTED] wrote: > > I facing one issue in Perl script. I am executing one command in Perl > script and taking the output of that command in one array. Now I want > to execute some more commands on each value of the array. > > But the problem is that I am passing each value of the arra

RE: function call help

2008-07-09 Thread Irfan.Sayed
tewart Anderson [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2008 7:45 PM To: Sayed, Irfan; beginners@perl.org Cc: Stewart Anderson Subject: RE: function call help Lock is a perl function http://perldoc.perl.org/functions/lock.html #! /usr/bin/perl # Perl script to ta

RE: function call help

2008-07-09 Thread Stewart Anderson
Lock is a perl function http://perldoc.perl.org/functions/lock.html #! /usr/bin/perl # Perl script to take the backup of critical clearcase data @vob_lst=(qw(test test1 test2)); foreach $a (@vob_lst) { lockvob($a); } sub lockvob { local ( $loc

Re: Function to convert GMT to Epoch (Was Re: Function to convert UTC to Epoch)

2006-07-28 Thread S.A. Birl
Time::Local will do what I want. On Jul 28, 2006, S.A. Birl ([EMAIL PROTECTED]) typed: Return-Path: <[EMAIL PROTECTED]> Date: Fri, 28 Jul 2006 12:32:34 -0400 (EDT) From: S.A. Birl <[EMAIL PROTECTED]> To: beginners@perl.org Subject: Function to convert GMT to E

Function to convert GMT to Epoch (Was Re: Function to convert UTC to Epoch)

2006-07-28 Thread S.A. Birl
On Jul 28, 2006, Joshua Colson ([EMAIL PROTECTED]) typed: Joshua: On Fri, 2006-07-28 at 10:51 -0400, S.A. Birl wrote: Joshua: > Was wondering if the there's a function to convert UTC time to Epoch Joshua: > time? Joshua: Joshua: Have you checked CPAN? Here is the first result from a search for

Re: Function to convert UTC to Epoch

2006-07-28 Thread Joshua Colson
On Fri, 2006-07-28 at 10:51 -0400, S.A. Birl wrote: > Was wondering if the there's a function to convert UTC time to Epoch > time? Have you checked CPAN? Here is the first result from a search for 'epoch': http://search.cpan.org/~pijll/DateTime-Format-Epoch-0.10/lib/DateTime/Format/Epoch.pm HTH

Re: Function call problem

2006-04-19 Thread John W. Krahn
Nath, Alok (STSD) wrote: > Hi all, Hello, > Can anybody help me to figure out why the first function call > works but the second one is unable to do it. > > Only difference is I am using DownloadFolder variable to send > the value. > > > #FtpVM('test.americas.corp.net', > '/1.00/

re function....

2004-11-29 Thread E.Horn
Thanks a lot Mr Paton! You are right, now it works great! Have a nice day... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Function to escape special characters

2004-08-29 Thread Gunnar Hjalmarsson
Yw Chan ) wrote: > Is there a Perl function for escape special characters in a > variable easily? Yes. You are supposed to look it up in "perldoc perlfunc" yourself rather than asking others to do so for you. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscri

RE: Function to escape special characters

2004-08-29 Thread Charles K. Clarkson
Yw Chan ( Cai Lun e-Business ) <[EMAIL PROTECTED]> wrote: : Hi, : : See if anyone out there can help again. : : Is there a Perl function for escape special characters in : a variable easily? So I don't need to use s/../... : explicitly for each of them? Which special characters are you refer

Re: function that returns a HASH.

2004-06-30 Thread Rod Za
ok, i got the response: > > and the function always returns somethings like this: > > HASH(0x81b99c4)HASH(0x81b988c)HASH(0x814fcf4)HASH(0x81b9c34)HASH(0x81b9afc)HASH(0x81a54f8) It's returning a reference to a hash. You can grab that reference into a scalar: my $hash_ref = function(); And the

Re: function that returns a HASH.

2004-06-30 Thread Rod Za
Oliver, this is wanderful! :) Thank you very much! --- Oliver Schnarchendorf <[EMAIL PROTECTED]> wrote: > to see what's going on in structured data types I strongly recommend the use > of DATA::DUMPER. > > Just include the module into your source code and when you print the $job

Re: function that returns a HASH.

2004-06-30 Thread Oliver Schnarchendorf
On Wed, 30 Jun 2004 11:44:53 -0700 (PDT), Rod Za wrote: > and the function always returns somethings like this: > HASH(0x81b99c4)HASH(0x81b988c)HASH(0x814fcf4)HASH(0x81b9c34)HASH(0x81b9afc)HASH(0x81a54f8) > > How can i get this results in an human redable mode? Hello Rod, to see what's go

Re: function that reads line numbers?

2004-02-01 Thread Randy W. Sims
On 1/30/2004 9:45 AM, Jeff 'japhy' Pinyan wrote: On Jan 30, Randy W. Sims said: On 01/30/04 03:59, John W. Krahn wrote: "Randy W. Sims" wrote: while (<>) { if ( $start_line .. $end_line ) { That will be true if $start_line is true and false if $start_line is false. The value in $end_line is

Re: function that reads line numbers?

2004-02-01 Thread MAC OS X
On 28 Jan 2004, at 04:22, Randy W. Sims wrote: On 1/27/2004 9:55 PM, Trina Espinoza wrote: So this may be wishful thinking, but I would be kicking myself later if I didn't ask. Is there a function in perl where you give the function exact line numbers and it would only read the data in the ran

Re: function that reads line numbers?

2004-01-30 Thread Jeff 'japhy' Pinyan
On Jan 30, Randy W. Sims said: >On 01/30/04 03:59, John W. Krahn wrote: >> "Randy W. Sims" wrote: >> >>>while (<>) { >>> if ( $start_line .. $end_line ) { >> >> That will be true if $start_line is true and false if $start_line is >> false. The value in $end_line is irrelevant. > >perl -lne 'pri

Re: function that reads line numbers?

2004-01-30 Thread Randy W. Sims
On 01/30/04 03:59, John W. Krahn wrote: "Randy W. Sims" wrote: On 1/27/2004 9:55 PM, Trina Espinoza wrote: So this may be wishful thinking, but I would be kicking myself later if I didn't ask. Is there a function in perl where you give the function exact line numbers and it would only read the d

Re: function that reads line numbers?

2004-01-30 Thread John W. Krahn
"Randy W. Sims" wrote: > > On 1/27/2004 9:55 PM, Trina Espinoza wrote: > > > So this may be wishful thinking, but I would be kicking myself later > > if I didn't ask. Is there a function in perl where you give the function > > exact line numbers and it would only read the data in the range of lin

Re: function that reads line numbers?

2004-01-29 Thread Randy W. Sims
On 1/27/2004 9:55 PM, Trina Espinoza wrote: So this may be wishful thinking, but I would be kicking myself later if I didn't ask. Is there a function in perl where you give the function exact line numbers and it would only read the data in the range of lines you gave it? My other alternative woul

Re: function that reads line numbers?

2004-01-29 Thread Jan Eden
Sorry, found the documentation. - Jan Tim wrote: >This is an example of the range operator '..' , which works with >operands on either side. In a scalar context, if either operand is a >numeric literal, it is compared to $. , which contains the current >line number of the input file. > >e.g. n

Re: function that reads line numbers?

2004-01-29 Thread Jan Eden
Yes, that's what Rob said and I know the range operator in general, but I just cannot find some principled explanation or hint to this behaviour in "Programming Perl". Did you discover it by accident? - Jan Tim wrote: >This is an example of the range operator '..' , which works with >operands

Re: function that reads line numbers?

2004-01-29 Thread Tim
This is an example of the range operator '..' , which works with operands on either side. In a scalar context, if either operand is a numeric literal, it is compared to $. , which contains the current line number of the input file. e.g. next if (5 .. /^Foo/); # skips lines 5 up to first lin

Re: function that reads line numbers?

2004-01-29 Thread Jan Eden
Rob Dixon wrote: >Jeff 'Japhy' Pinyan wrote: >> >> while () { >> print "small " if 1 .. 10; >> print "medium " if 6 .. 15; >> print "big " if 11 .. 20; >> print "\n"; >> } > >Careful here Jeff. '..' compares its operands with $. >(current record number) in a scalar context. >

Re: function that reads line numbers?

2004-01-29 Thread Rob Dixon
Jeff 'japhy' Pinyan wrote: > > On Jan 29, Rob Dixon said: > > >Jeff 'Japhy' Pinyan wrote: > >> > >> while () { > >> print "small " if 1 .. 10; > >> print "medium " if 6 .. 15; > >> print "big " if 11 .. 20; > >> print "\n"; > >> } > > > >Careful here Jeff. '..' compares its ope

Re: function that reads line numbers?

2004-01-29 Thread Jeff 'japhy' Pinyan
On Jan 29, Rob Dixon said: >Jeff 'Japhy' Pinyan wrote: >> >> while () { >> print "small " if 1 .. 10; >> print "medium " if 6 .. 15; >> print "big " if 11 .. 20; >> print "\n"; >> } > >Careful here Jeff. '..' compares its operands with $. >(current record number) in a scalar co

Re: function that reads line numbers?

2004-01-29 Thread Rob Dixon
Jeff 'Japhy' Pinyan wrote: > > while () { > print "small " if 1 .. 10; > print "medium " if 6 .. 15; > print "big " if 11 .. 20; > print "\n"; > } Careful here Jeff. '..' compares its operands with $. (current record number) in a scalar context. Rob -- To unsubscribe, e-ma

Re: function that reads line numbers?

2004-01-29 Thread Jeff 'japhy' Pinyan
On Jan 28, John McKown said: >On Wed, 28 Jan 2004, Jeff 'japhy' Pinyan wrote: > >> while () { >> if (10 .. 20) { >> print; # displays lines 10 through 20 >> } >> } > >Wouldn't the following be slightly faster? > > while () { > next if $. < $start; >

Re: function that reads line numbers?

2004-01-29 Thread John McKown
On Wed, 28 Jan 2004, Jeff 'japhy' Pinyan wrote: > > When you read a line from a filehandle, Perl stores the line number in $., > so you can use that to your advantage: > > while () { > if ($. >= $start and $. <= $end) { > print; # or do whatever > } > } > > What's even better

Re: function that reads line numbers?

2004-01-28 Thread Trina Espinoza
d see what best suites my task. It's nice to have options when trying to solve a problem, so thanks everyone :) -T - Original Message - From: "Owen Cook" <[EMAIL PROTECTED]> To: "Trina Espinoza" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sen

Re: function that reads line numbers?

2004-01-28 Thread John W. Krahn
Trina Espinoza wrote: > > So this may be wishful thinking, but I would be kicking myself > later if I didn't ask. Is there a function in perl where you give > the function exact line numbers and it would only read the data > in the range of lines you gave it? You can use integer literals with th

Re: function that reads line numbers?

2004-01-28 Thread Rob Dixon
Trina Espinoza wrote: > > So this may be wishful thinking, but I would be kicking myself later if I didn't > ask. Is there a function in perl where you give the function exact line numbers > and it would only read the data in the range of lines you gave it? My other > alternative would be using a

Re: function that reads line numbers?

2004-01-28 Thread Owen Cook
On Tue, 27 Jan 2004, Trina Espinoza wrote: > So this may be wishful thinking, but I would be kicking myself later if I didn't > ask. Is there a function in perl where you give > the function exact line numbers and it would only read the data in the range of > lines you gave it? My other altern

Re: function that reads line numbers?

2004-01-28 Thread James Edward Gray II
On Jan 27, 2004, at 8:55 PM, Trina Espinoza wrote: So this may be wishful thinking, but I would be kicking myself later if I didn't ask. Is there a function in perl where you give the function exact line numbers and it would only read the data in the range of lines you gave it? My other alterna

Re: function that reads line numbers?

2004-01-28 Thread Jeff 'japhy' Pinyan
On Jan 27, Trina Espinoza said: >So this may be wishful thinking, but I would be kicking myself later if I >didn't ask. Is there a function in perl where you give the function exact >line numbers and it would only read the data in the range of lines you >gave it? My other alternative would be usin

Re: function that reads line numbers?

2004-01-27 Thread Kenton Brede
On Tue, Jan 27, 2004 at 06:55:50PM -0800, Trina Espinoza ([EMAIL PROTECTED]) wrote: > So this may be wishful thinking, but I would be kicking myself later if I didn't > ask. Is there a function in perl where you give > the function exact line numbers and it would only read the data in the range o

Re: question re: Function Templates

2003-09-09 Thread R. Joseph Newton
"R. Joseph Newton" wrote: > > Another samll problem, if this was used for generating web content, is the > choice of embedded quote operators. At least on my installation, the > apostrophes remain apostrophes.. Spoke too soon, I guess. The browser doesn't seem to mind single quotes at all, at l

Re: question re: Function Templates

2003-09-09 Thread R. Joseph Newton
Jenda Krynicky wrote: > From: sfryer <[EMAIL PROTECTED]> > > I'm reading perldoc perlref right now and under the Function Templates > > section, I've come across something that's got me stumped. The code in > > question is as follows... > > > >@colors = qw(red blue green yellow orange purple v

Re: question re: Function Templates

2003-09-09 Thread Jenda Krynicky
From: sfryer <[EMAIL PROTECTED]> > I'm reading perldoc perlref right now and under the Function Templates > section, I've come across something that's got me stumped. The code in > question is as follows... > >@colors = qw(red blue green yellow orange purple violet); >for my $name (@colors

Re: question re: Function Templates

2003-09-09 Thread Paul Johnson
sfryer said: > I'm reading perldoc perlref right now and under the Function Templates > section, I've come across something that's got me stumped. The code in > question is as follows... > >@colors = qw(red blue green yellow orange purple violet); >for my $name (@colors) { >no str

question re: Function Templates

2003-09-09 Thread sfryer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm reading perldoc perlref right now and under the Function Templates section, I've come across something that's got me stumped. The code in question is as follows... @colors = qw(red blue green yellow orange purple violet); for my $name (@colo

Re: function to encode/decode url

2003-08-19 Thread Morbus Iff
>> Can anyone tell me where I can find encoding functions like >> encode("[EMAIL PROTECTED]") ==> ram%40yahoo.com >> and decode("ram%40yahoo.com") ==> [EMAIL PROTECTED] > >As usualy. See CPAN - http://search.cpan.org/ >Eg. CGI::Enurl + CGI::Deurl I prefer URI::Escape, myself. -- Morbus Iff ( i'm

Re: function to encode/decode url

2003-08-19 Thread Jenda Krynicky
From: Ramprasad A Padmanabhan <[EMAIL PROTECTED]> > I know there must be a function to encode/decode urls > I was searching the LWP documentation but couldnt find any > > Can anyone tell me where I can find encoding functions like > > encode("[EMAIL PROTECTED]") ==> ram%40yahoo.com > > and decod

Re: Function to pass a variable to numeric value

2003-03-14 Thread Rob Dixon
Hi Ruben Ruben Montes wrote: > Hello, > I'm working with Net::SNMP and I need to consult an OID. The last > number of the OID is a variable and I want to make a get of this OID, > but the debugger says it's not a numeric value... > > $i=1 > while($i<4){ > my $descr ='1.3.6.1.2.1.2.2.1.2.($i)'; > .

Re: Function to pass a variable to numeric value

2003-03-14 Thread John W. Krahn
Ruben Montes wrote: > > Hello, Hello, > I'm working with Net::SNMP and I need to consult an OID. The last number of > the OID is a variable and I want to make a get of this OID, but the debugger > says it's not a numeric value... > > $i=1 > while($i<4){ If you want to loop thro

Re: function system

2002-12-18 Thread Ramprasad
never rely on multiple system() to execute your commands in the same order It will be most advisable that If you really have to execute multiple UNIX commands then make a shell script of them and execute the shell script of course you can do this system("unix_comd1;unix_comd2;unix_comd3"); Ped

Re: Function...

2002-10-28 Thread Paul Johnson
On Sun, Oct 27, 2002 at 09:42:10PM +0200, Piedro wrote: > Hello, > I was wondering whether there is an integrated function in Perl, that makes > strings' combinations,for example: > I have 4 digits, each of which can take the discrete values of 0 and 1. I > want to have these combinations as outpu

Re: Function...

2002-10-28 Thread Piedro
Thanx a lot!!! Ï "Piedro" <[EMAIL PROTECTED]> Ýãñáøå óôï ìÞíõìá news:20021027192246.89474.qmail@;onion.perl.org... > Hello, > I was wondering whether there is an integrated function in Perl, that makes > strings' combinations,for example: > I have 4 digits, each of which can take the discrete value

Re: function for finding the index of an element in an array?

2002-07-25 Thread John W. Krahn
Daniel David wrote: > > Hi, Hello, > I couldn't seem to find a built-in function for finding the index > of an element in an array...so I wrote this one: > > > > # position_of returns the position of a string in an array of

Re: function for finding the index of an element in an array?

2002-07-25 Thread Janek Schleicher
Daniel David wrote at Thu, 25 Jul 2002 12:00:29 +0200: > I couldn't seem to find a built-in function for finding the index of an element in >an array...so I > wrote this one: > ... > > it works but somehow i feel there's a built in function for this You could also exploit the List::Util mo

Re: function for finding the index of an element in an array?

2002-07-25 Thread Connie Chan
nt: Thursday, July 25, 2002 9:07 PM Subject: Re: function for finding the index of an element in an array? > > > Right! I have the same idea as you, and I have this : > > > > my @list = ('1234', '4567', '789A', 'BCDE', 'FGHI')

Re: function for finding the index of an element in an array?

2002-07-25 Thread Robin Norwood
Kay Bieri <[EMAIL PROTECTED]> writes: > > Right! I have the same idea as you, and I have this : > > > > my @list = ('1234', '4567', '789A', 'BCDE', 'FGHI'); > > my $GetLocation = 0; > > my $value = 'BCDE'; > > > > for (my $atLoc = 0; $atLoc <= $#list and ! $GetLocation ; $atLoc++) > > { $GetLocat

Re: function for finding the index of an element in an array?

2002-07-25 Thread Kay Bieri
> Right! I have the same idea as you, and I have this : > > my @list = ('1234', '4567', '789A', 'BCDE', 'FGHI'); > my $GetLocation = 0; > my $value = 'BCDE'; > > for (my $atLoc = 0; $atLoc <= $#list and ! $GetLocation ; $atLoc++) > { $GetLocation = $atLoc if ($value eq $list[$atLoc]) } > > And

Re: function for finding the index of an element in an array?

2002-07-25 Thread Connie Chan
Right! I have the same idea as you, and I have this : my @list = ('1234', '4567', '789A', 'BCDE', 'FGHI'); my $GetLocation = 0; my $value = 'BCDE'; for (my $atLoc = 0; $atLoc <= $#list and ! $GetLocation ; $atLoc++) { $GetLocation = $atLoc if ($value eq $list[$atLoc]) } And I finally got t

Re: function for finding the index of an element in an array?

2002-07-25 Thread Sudarshan Raghavan
On Thu, 25 Jul 2002, Sudarshan Raghavan wrote: > On Thu, 25 Jul 2002, Daniel David wrote: > > > Hi, > > I couldn't seem to find a built-in function for finding the index > > of an element in an array...so I wrote this one: > > > >

Re: function for finding the index of an element in an array?

2002-07-25 Thread Sudarshan Raghavan
On Thu, 25 Jul 2002, Daniel David wrote: > Hi, > I couldn't seem to find a built-in function for finding the index > of an element in an array...so I wrote this one: > > > > # position_of returns the position of a string in a

Re: Function for converting a specific date to number of seconds since 01/01/1970?

2002-06-18 Thread Todd Wade
Alan Hogue wrote: > Hi, > > I need to know the easiest way to translate a date (not today's date) > into the number of seconds since 01/01/1970. I realize there is at > least one function that turns the current date/time into this number, > but I need to find, for instance, everything with a dat

RE: Function for converting a specific date to number of seconds since 01/01/1970?

2002-06-18 Thread Timothy Johnson
Look up the Time::Local module. It should be able to do what you need. -Original Message- From: Alan Hogue [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 18, 2002 12:39 PM To: [EMAIL PROTECTED] Subject: Function for converting a specific date to number of seconds since 01/01/1970? Hi,

Re: Function for converting a specific date to number of seconds since 01/01/1970?

2002-06-18 Thread Kevin Old
Alan, Use the Date::Manip module from CPANlook at the DateCalc subroutine. HTH, Kevin On Tue, 18 Jun 2002 12:38:57 -0700 (PDT) Alan Hogue <[EMAIL PROTECTED]> wrote: > Hi, > > I need to know the easiest way to translate a date (not today's date) > into the number of seconds since 01/01/197

  1   2   >