Put this line as the last line executed in your subroutine:
return $sum;
That makes it explicit as to what you want the subroutine to do. Don’t depend
upon some obscure behavior of Perl to save a few keystrokes. Your program will
be better for it.
> On May 14, 2025, at 4:15 PM, Daryl
> In the above line, `shift` will return just the first element from the
> @_ array. $y will therefore be undefined. The line should be rewritten
> as:
> my ( $x, $y ) = @_;
>
Thank you. I should have caught that.
Chris
Hello Chris,
> Can this subroutine be better written?
> I am getting the following erros:
>
> Use of uninitialized value $y in subtraction (-) at form.pl line 52.
> Use of uninitialized value $y in addition (+) at form.pl line 52.
>
> sub avg_az {
> my($x, $y) = shift(@_);
In the above line, `s
On 11/08/2012 12:43, Shawn H Corey wrote:
No, @ISA is used only by Exporter.pm
Exporter makes no use of @ISA at all. This array is a per-package
variable used by Perl internally to implement object-oriented
inheritance. It is very often used to make a package a subclass of
Exporter, but that i
August 11, 2012 6:43 AM
Subject: Re: subroutine in seperate file, question
On Sat, 11 Aug 2012 02:49:56 -0400
shawn wilson wrote:
> On Aug 10, 2012 11:41 PM, wrote:
> >
> > > I mean to ask, wether they will clash with the same loaded modules
> loaded
> > > in ca
On Sat, 11 Aug 2012 02:49:56 -0400
shawn wilson wrote:
> On Aug 10, 2012 11:41 PM, wrote:
> >
> > > I mean to ask, wether they will clash with the same loaded modules
> loaded
> > > in calling script?
> > >
> >
> > No. they are loaded only once.
> >
>
> Well, they will both be in ISA to look up
On Aug 10, 2012 11:41 PM, wrote:
>
> > I mean to ask, wether they will clash with the same loaded modules
loaded
> > in calling script?
> >
>
> No. they are loaded only once.
>
Well, they will both be in ISA to look up separately but there is no
conflict.
> I mean to ask, wether they will clash with the same loaded modules loaded
> in calling script?
>
No. they are loaded only once.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
I mean to ask, wether they will clash with the same loaded modules loaded in
calling script?
From: "pa...@riseup.net"
To: Rajeev Prasad
Cc: perl list
Sent: Friday, August 10, 2012 9:05 PM
Subject: Re: subroutine in seperate file, question
Yes, t
Yes, the modules in required file will be loaded.
$ cat ext.pl
use CGI;
use DBI;
1;
$ cat main.pl
require 'ext.pl';
use Data::Dumper;
print Dumper \%INC;
Thus run perl main.pl to see what prints.
> i want to keep a peice of code which uses CGI and DBIx module in a
> seperate file, and want t
Hi all,
On Tue, 05 Jun 2012 10:15:36 -0700
"John W. Krahn" wrote:
> [ Please do not top-post your replies. Please remove non-relevant text
> from your reply before posting. TIA ]
> > don't insult and dismiss out of hand the findings of those who take the
> > time to help you.
>
> If I insul
[ Please do not top-post your replies. Please remove non-relevant text
from your reply before posting. TIA ]
Jack Maney wrote:
ProTip:
The top two results from Google state:
PROTIP | Know Your Meme
About PROTIP is a term often used in forums and comments to preface snarky,
obvious, count
:08 AM, Jack Maney wrote:
> ProTip: If you're going to ask for help, don't insult and dismiss out of hand
> the findings of those who take the time to help you.
>
> -Original Message-
> From: John W. Krahn [mailto:jwkr...@shaw.ca]
> Sent: Tuesday, June 05, 201
ProTip: If you're going to ask for help, don't insult and dismiss out of hand
the findings of those who take the time to help you.
-Original Message-
From: John W. Krahn [mailto:jwkr...@shaw.ca]
Sent: Tuesday, June 05, 2012 2:18 AM
To: Perl Beginners
Subject: Re: subroutine
Shlomi Fish wrote:
On Mon, 04 Jun 2012 14:19:27 -0700
"John W. Krahn" wrote:
Chris Stinemetz wrote:
I have a subroutine that I want to "return 1" only if the value of
%{$href->{$_[0]}} is equal to 'ND' for the whole 24 occurences.
One way to do it:
sub site_offAir {
return values %{
Hello John,
On Mon, 04 Jun 2012 14:19:27 -0700
"John W. Krahn" wrote:
> Chris Stinemetz wrote:
> > I have a subroutine that I want to "return 1" only if the value of
> > %{$href->{$_[0]}} is equal to 'ND' for the whole 24 occurences.
>
>
> One way to do it:
>
> sub site_offAir {
> return
Chris Stinemetz wrote:
I have a subroutine that I want to "return 1" only if the value of
%{$href->{$_[0]}} is equal to 'ND' for the whole 24 occurences.
One way to do it:
sub site_offAir {
return values %{ $href->{ $_[ 0 ] } } == grep( $_ eq 'ND', values
%{ $href->{ $_[ 0 ] } } ) ? 1 :
Thank you everyone. Your help has been very helpful..
Chris
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
On 12-06-04 02:01 PM, Bill Stephenson wrote:
The "values %{$href->{$_[0]}}" code is pretty ugly but I get it now. And it
make sense to break out of the loop as soon as you don't pass the test.
sub site_offAir {
my $site_id = shift @_;
for my $activity_code ( values %{ $activity_of->{$sit
Thanks Shawn!
The "values %{$href->{$_[0]}}" code is pretty ugly but I get it now. And it
make sense to break out of the loop as soon as you don't pass the test.
Kindest Regards,
Bill Stephenson
On Jun 4, 2012, at 12:49 PM, Shawn H Corey wrote:
> On 12-06-04 12:30 PM, Chris Stinemetz wrote
On 12-06-04 12:30 PM, Chris Stinemetz wrote:
I have a subroutine that I want to "return 1" only if the value of
%{$href->{$_[0]}} is equal to 'ND' for the whole 24 occurences.
Any suggestions is greatly appreciated.
Thank you,
Chris
sub site_offAir {
for (values %{$href->{$_[0]}}) {
r
On Jun 4, 2012, at 11:30 AM, Chris Stinemetz wrote:
> I have a subroutine that I want to "return 1" only if the value of
> %{$href->{$_[0]}} is equal to 'ND' for the whole 24 occurences.
>
> Any suggestions is greatly appreciated.
>
Chris, I don't know how to read your hash directly (hash of ha
On Mon, Jun 04, 2012 at 11:30:30AM -0500, Chris Stinemetz wrote:
> I have a subroutine that I want to "return 1" only if the value of
> %{$href->{$_[0]}} is equal to 'ND' for the whole 24 occurences.
>
> Any suggestions is greatly appreciated.
>
> Thank you,
>
> Chris
>
> sub site_offAir {
>
Hi Ganesh,
On Mon, 5 Dec 2011 14:16:29 +0530
ganesh vignesh wrote:
> stop mail to me
The instructions at the bottom of every E-mail read:
[QUOTE]
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
[/QUOTE]
Ple
Hello, John.
On Sun, 04 Dec 2011 12:46:40 -0800
"John W. Krahn" wrote:
> > You should assign $marketInfo{$mkt} to a variable, or alternatively do:
> >
> > my ($start, $end) = @{$marketInfo{$mkt}}{qw(start end)};
> >
> >> my $end = $marketInfo{$mkt}->{"end"};
> >> if( $cell>=
Shlomi Fish wrote:
in addition to the good advice that Uri gave you - some comments on your code.
On Sun, 4 Dec 2011 07:40:09 -0600
Chris Stinemetz wrote:
I have a program that I am working on improveing. The fist step I have
taken is converting it in using the strict pragma.
Now when this
On 2011-12-04 18:12, Shlomi Fish wrote:
Chris wrote:
my $cell = substr($market,0,index($market,"_"));
print "$_ <", substr( $_, 0, index $_, "_" ), ">\n"
for qw/ foo1 foo2_bar foo3_bar_baz /;
foo1
foo2_bar
foo3_bar_baz
This can be more idiomatically (and more briefly) done us
Hi Chris,
in addition to the good advice that Uri gave you - some comments on your code.
On Sun, 4 Dec 2011 07:40:09 -0600
Chris Stinemetz wrote:
> I have a program that I am working on improveing. The fist step I have
> taken is converting it in using the strict pragma.
>
> Now when this subr
On 12/04/2011 08:40 AM, Chris Stinemetz wrote:
I have a program that I am working on improveing. The fist step I have
taken is converting it in using the strict pragma.
Now when this subroutine call is made I get the following compilation error:
Global symbol "$cell" requires explicit package n
On Wednesday 03 Nov 2010, Uri Guttman wrote:
> the recommended style IS to call subs with (). where did you get the
> opposite idea?
As I said, I think I'd read it somewhere. Yeah, may be that was required with
only Perl 4 or earlier.
> APK> I remember I'd read in the past that & should be us
> "APK" == Akhthar Parvez K writes:
APK> On Sunday 31 Oct 2010, Shlomi Fish wrote:
APK> [ snipped ]
>> > &testsub1();
>>
>> Don't use leading ampersands in subroutine calls:
APK> Suppose a subroutine definition is written down the line and it's
APK> called without (), which is
On Sunday 31 Oct 2010, Shlomi Fish wrote:
[ snipped ]
> > &testsub1();
>
> Don't use leading ampersands in subroutine calls:
Suppose a subroutine definition is written down the line and it's called
without (), which is the recommended style:
&SubRoutine
or
SubRoutine
I remember I'd read in the
Hi Owen,
On Saturday 30 October 2010 20:56:57 Owen Chavez wrote:
> A straightforward question I hope.
>
> Can someone explain why the following code runs without a hitch:
>
> #!C:/strawberry/perl/bin/perl.exe
> use strict;
> use warnings;
>
> my $testvar = "TEST";
> &testsub1();
Don't use lead
> "OC" == Owen Chavez writes:
OC> use strict;
OC> use warnings;
that is good.
OC> my $testvar = "TEST";
OC> &testsub1();
that is wrong. don't call subs with & as it isn't needed and can cause a
bug if you don't know what you are doing with it.
OC> sub testsub1 {
OC> print "The
On Mon, Oct 11, 2010 at 5:28 PM, Jyoti wrote:
> Hello,
>
> Can anyone help me out to call all subroutines from different .pm files in
> a
> specific directory please ?
>
> Many Thanks,
> Jyoti
>
Hi Jyoti,
I think you should be a little more specific I assume you are asking how to
include a mod
On 12 April 2010 16:39, Uri Guttman wrote:
>> "PP" == Philip Potter writes:
>
> PP> On 12 April 2010 11:34, Shlomi Fish wrote:
> >> Hi Uri and Philip (and Abimael),
> >> On Monday 12 Apr 2010 10:32:36 Uri Guttman wrote:
> >>> PP> Where did I say PBP was always right? I just didn't want
> "PP" == Philip Potter writes:
PP> On 12 April 2010 11:34, Shlomi Fish wrote:
>> Hi Uri and Philip (and Abimael),
>> On Monday 12 Apr 2010 10:32:36 Uri Guttman wrote:
>>> PP> Where did I say PBP was always right? I just didn't want to let your
>>> PP> style argument be the onl
On Monday 12 Apr 2010 13:59:31 Philip Potter wrote:
> On 12 April 2010 11:34, Shlomi Fish wrote:
> > Hi Uri and Philip (and Abimael),
> >
> > On Monday 12 Apr 2010 10:32:36 Uri Guttman wrote:
> >> PP> Where did I say PBP was always right? I just didn't want to let
> >> your PP> style argument b
On 12 April 2010 11:34, Shlomi Fish wrote:
> Hi Uri and Philip (and Abimael),
> On Monday 12 Apr 2010 10:32:36 Uri Guttman wrote:
>> PP> Where did I say PBP was always right? I just didn't want to let your
>> PP> style argument be the only one in this thread, since there are
>> clearly PP> peo
Hi Uri and Philip (and Abimael),
On Monday 12 Apr 2010 10:32:36 Uri Guttman wrote:
> > "PP" == Philip Potter writes:
> PP> On 12 April 2010 07:55, Uri Guttman wrote:
> >>> "PP" == Philip Potter writes:
> >> PP> On 12 April 2010 04:31, Uri Guttman wrote:
> >> >>> "AM" == A
> "PP" == Philip Potter writes:
PP> On 12 April 2010 07:55, Uri Guttman wrote:
>>> "PP" == Philip Potter writes:
>>
>> PP> On 12 April 2010 04:31, Uri Guttman wrote:
>> >>> "AM" == Abimael Martinez writes:
>> >>
>> >> AM> print {$tmp} "$div_start";
>> >>
On 12 April 2010 07:55, Uri Guttman wrote:
>> "PP" == Philip Potter writes:
>
> PP> On 12 April 2010 04:31, Uri Guttman wrote:
> >>> "AM" == Abimael Martinez writes:
> >>
> >> AM> print {$tmp} "$div_start";
> >>
> >> no need for the {} around a single scalar handle.
>
> PP> Bu
> "PP" == Philip Potter writes:
PP> On 12 April 2010 04:31, Uri Guttman wrote:
>>> "AM" == Abimael Martinez writes:
>>
>> AM> print {$tmp} "$div_start";
>>
>> no need for the {} around a single scalar handle.
PP> But it *does* comply with Perl Best Practices #136.
On 12 April 2010 04:31, Uri Guttman wrote:
>> "AM" == Abimael Martinez writes:
>
> AM> print {$tmp} "$div_start";
>
> no need for the {} around a single scalar handle.
But it *does* comply with Perl Best Practices #136.
* It makes the filehandle obviously different from the other argumen
Abimael Martinez wrote:
Hi,
Hello,
I am having some problems making this little script work, it is supposed
glob files from current dir, and add stuff at the top and bottom of such
files. I am also unshure how the "autoflush" works.
use strict;
use IO::File;
use IO::Handle qw( );
my @
> "AM" == Abimael Martinez writes:
AM> Hi,
AM> I am having some problems making this little script work, it is supposed
AM> glob files from current dir, and add stuff at the top and bottom of such
AM> files. I am also unshure how the "autoflush" works.
AM> use strict;
AM> u
2009/7/29 Shawn H. Corey :
> Chas. Owens wrote:
>>
>> On Wed, Jul 29, 2009 at 04:37, Dermot wrote:
>> snip
>>>
>>> I'll grab myself a version of Scalar::Utils and have a play.
>>
>> snip
>>
>> If your version of Perl is 5.8.0 or later you already have
>> Scalar::Utils (it is in the core).
More la
Chas. Owens wrote:
On Wed, Jul 29, 2009 at 04:37, Dermot wrote:
snip
I'll grab myself a version of Scalar::Utils and have a play.
snip
If your version of Perl is 5.8.0 or later you already have
Scalar::Utils (it is in the core).
Actually, that would be Scalar::Util
You may, however, wish
On Wed, Jul 29, 2009 at 04:37, Dermot wrote:
snip
> I'll grab myself a version of Scalar::Utils and have a play.
snip
If your version of Perl is 5.8.0 or later you already have
Scalar::Utils (it is in the core).
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ab
2009/7/29 John W. Krahn :
> Dermot wrote:
>>
>> 2009/7/28 John W. Krahn :
>>>
>>> Dermot wrote:
2009/7/28 John W. Krahn :
Thanx for gettig back to me.
> Which error? Copy and paste the error message you are receiving.
Opps sorry. Here you are. Every time I st
Dermot wrote:
2009/7/28 John W. Krahn :
Dermot wrote:
2009/7/28 John W. Krahn :
Thanx for gettig back to me.
Which error? Copy and paste the error message you are receiving.
Opps sorry. Here you are. Every time I start the httpd I get
Processing config file: /etc/apache-modperl/conf.d/de
On Tue, Jul 28, 2009 at 17:05, Dermot wrote:
snip
>> my $bid = shift;
>> my $items = ref $_[0] ? $_[0] : \...@_;
>>
>
> Perhaps you can expand, if $_[0] was a scalar wouldn't that get
> assigned to $items?
snip
Normal scalars (i.e. strings and numbers) are not references,
therefore the resul
2009/7/28 John W. Krahn :
> Dermot wrote:
>>
>> 2009/7/28 John W. Krahn :
>>
>> Thanx for gettig back to me.
>>
>>> Which error? Copy and paste the error message you are receiving.
>>
>> Opps sorry. Here you are. Every time I start the httpd I get
>>
>
> That message means that you have defined tw
Dermot wrote:
2009/7/28 John W. Krahn :
Thanx for gettig back to me.
Which error? Copy and paste the error message you are receiving.
Opps sorry. Here you are. Every time I start the httpd I get
Processing config file: /etc/apache-modperl/conf.d/dev_vhost.conf
Subroutine addItemsToBasket
2009/7/28 John W. Krahn :
Thanx for gettig back to me.
> Which error? Copy and paste the error message you are receiving.
Opps sorry. Here you are. Every time I start the httpd I get
Processing config file: /etc/apache-modperl/conf.d/dev_vhost.conf
Subroutine addItemsToBasket redefined at
/ex
Dermot wrote:
Hi,
Hello,
I noticed this error appearing when I stop/started my httpd server
recently (yes this is modperl 1 code).
Which error? Copy and paste the error message you are receiving.
This offending code reads a like this:
package Some::Pack;
..
..
sub addItemsToBasket {
Shawn,
Your code
my ( $whoami ) = grep { m{ \b ServiceScript \. pl \b }msx } values %INC;
print "$whoami\n";
works great!! If you have time, could you explain to a Windows guy like
me what the grep is doing?
Yes, I know that someone could still spoof me, but this is my first line
of defense.
-
Sorry, I had a typo. My code snippet above should have said:
require 'ServiceScript.pl';
my $svccmdline = "$uspname $uspparams";
$rtncode = ServiceRoutine($svccmdline, \...@rtndata);
- Marko
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h.
On Tue, 2009-01-27 at 12:27 -0500, Malyj, Mark wrote:
> Your code
>
> my ( $whoami ) = grep { m{ \b ServiceScript \. pl \b }msx } values %
> INC;
> print "$whoami\n";
>
> works great!! If you have time, could you explain to a Windows guy
> like
> me what the grep is doing?
See `perldoc -f grep`
On Mon, 2009-01-26 at 15:07 -0800, mark.ma...@gdit.com wrote:
> My question is this – how can my ServiceRoutine in ServiceScript.pl
> get its own path? I would like to record this to the database for
> auditing purposes as well, to make sure no one is using a substitute
> version of ServiceRoutine
Thanks, the latter one works for me. Appreciate all the help.
"Chas. Owens" <[EMAIL PROTECTED]> wrote: On Wed, Mar 26, 2008 at 12:32 PM,
Bobby wrote:
> Chas,
>
> Thanks for all your pointers. I guess i should read a Perl book first before
> attempting to write codes in it :). I'm learning the h
On Wed, Mar 26, 2008 at 12:32 PM, Bobby <[EMAIL PROTECTED]> wrote:
> Chas,
>
> Thanks for all your pointers. I guess i should read a Perl book first before
> attempting to write codes in it :). I'm learning the hard way but making
> small progresses. I was using what little knowledge i have and duc
Chas,
Thanks for all your pointers. I guess i should read a Perl book first before
attempting to write codes in it :). I'm learning the hard way but making small
progresses. I was using what little knowledge i have and duck taped my way
around the problem. Maybe one day i will get this Perl thi
On Tue, Mar 25, 2008 at 1:47 PM, Bobby <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I need another set of eyes to help look over the codes below. I have a
> subroutine that check for a comma in $strA and do some regex replacement, if
> there's no comma then return the values of the two arguments passed
From: "Kashif Salman" <[EMAIL PROTECTED]>
> I know I can create html code using CGI and call a subroutine in there
> easily but if i were to use a here document for my html code, can I
> call a subroutine in there?
>
> print< HTML code
> <--Can I call foo() in here somehow?
> E
Kashif Salman wrote:
>
I know I can create html code using CGI and call a subroutine in there
easily but if i were to use a here document for my html code, can I
call a subroutine in there?
print<
Yes you can, but I'd rather not tell you how because it's likely to be
the ugliest of several poss
Kashif Salman wrote:
I know I can create html code using CGI and call a subroutine in there
easily but if i were to use a here document for my html code, can I
call a subroutine in there?
print<
Check out the FAQ entry
perldoc -q "function calls"
--
Gunnar Hjalmarsson
Email: http://www.gu
On Feb 18, 2008 11:17 AM, David Moreno <[EMAIL PROTECTED]> wrote:
>
> On Feb 17, 2008 3:48 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
>
> > use IO::Handle;
> > STDOUT->autoflush;
> >
> > to the start of your program.
>
>
> What's the difference from this to setting $| to true?
snip
In this speci
On Feb 17, 2008 3:48 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> use IO::Handle;
> STDOUT->autoflush;
>
> to the start of your program.
What's the difference from this to setting $| to true?
--
David Moreno - http://www.damog.net/
Yes, you can.
PROBLEM SOLVED on comp.lang.perl.tk:
$MW->update; # whenever you want the screen updated
On 02/18/2008 09:46:51 AM, MK wrote:
okay, this is definitely a Tk or GUI issue, since incorporating a for
real "print" (ie. to STDOUT) statement does come out in proper
sequence.
--
To unsubsc
okay, this is definitely a Tk or GUI issue, since incorporating a for
real "print" (ie. to STDOUT) statement does come out in proper sequence.
Does anyone know if there is a filehandle other than STDOUT for tk
requests?
The simplest version of the problem:
use IO::Handle;
sub tmptest {
On 02/17/2008 03:48:40 PM, Rob Dixon wrote:
MK wrote:
>
I have a subroutine that begins with a message ("Processing...") and
then
proceeds to perform several gigs worth of file transfer via system
calls.
Basically:
sub transfer {
print "Processing...\n";
foreach $e (@array) {
MK wrote:
I have a subroutine that begins with a message ("Processing...") and
then proceeds to perform several gigs worth of file transfer via system
calls. Basically:
sub transfer {
print "Processing...\n";
foreach $e (@array) {
print "file $e\n";
system "cp $e"; #
MK wrote:
>
I have a subroutine that begins with a message ("Processing...") and
then proceeds to perform several gigs worth of file transfer via system
calls. Basically:
sub transfer {
print "Processing...\n";
foreach $e (@array) {
print "file $e\n";
system "cp $e"; #
From: "Mr. Shawn H. Corey" <[EMAIL PROTECTED]>
> Dr.Ruud wrote:
> >> Why do people who write these books have exercises of little
> >> practical value?
> >
> > An exercise needs to be educational.
>
> I have worked in programming for 25 years and during that time I have
> never use a closure an
From: Chris <[EMAIL PROTECTED]>
> Ok, if anyone is interested, here is my answer:
>
> #!/usr/bin/perl -w
>
> # Testing code for Exercise 6-1. Your task is to write the sub
> # gather_mtime_between.
>
> use strict;
>
> use File::Find;
> use Time::Local;
>
> my ($start, $stop)
On Sun, 26 Aug 2007 13:04:48 -0400, Mr. Shawn H. Corey wrote:
> I have worked in programming for 25 years and during that time I have
> never use a closure and have never seen one used.
Boggle. I don't think any program I write these days doesn't have one.
They're the most convenient way of re
On 8/26/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:
> Dr.Ruud wrote:
> >> Why do people who write these books have exercises of little
> >> practical value?
> >
> > An exercise needs to be educational.
>
> I have worked in programming for 25 years and during that time I have never
> use a
>
In article <[EMAIL PROTECTED]>, Mr. Shawn H. Corey
<[EMAIL PROTECTED]> wrote:
> Chris wrote:
> > I'm working on yet another exercise from Intermediate Perl. I've been
> > given a script that searches for files that fall between a two
> > timestamps.
> Why do people who write these books have e
Mr. Shawn H. Corey wrote:
Dr.Ruud wrote:
Why do people who write these books have exercises of little
practical value?
An exercise needs to be educational.
I have worked in programming for 25 years and during that time I have
never use a closure and have never seen one used. I may be har
> "Shawn" == "Mr Shawn H Corey" <[EMAIL PROTECTED]> writes:
Shawn> Oh, I get it. When I said 25 years, you thought that I meant 25 years
Shawn> with Perl.
No.
Shawn> Sorry, about the confusion.
No confusion.
Shawn> I have programmed in many different languages and have never seen a
Randal L. Schwartz wrote:
"Shawn" == Shawn H Corey <[EMAIL PROTECTED]> writes:
Shawn> Why do you include an insult with every thing you post?
I don't think I do. I was only making fun of your claim, since you made the
claim. Why did you include "25 years"? It just sets you up for a fall. :)
> "Shawn" == Shawn H Corey <[EMAIL PROTECTED]> writes:
Shawn> Why do you include an insult with every thing you post?
I don't think I do. I was only making fun of your claim, since you made the
claim. Why did you include "25 years"? It just sets you up for a fall. :)
Shawn> BTW, what lege
Randal L. Schwartz wrote:
Think of closures as "variables that hold behavior". Sure, maybe you've never
needed that in your legendary 25 years in the industry, but I've used it
*frequently* in my 30 years. :)
Why do you include an insult with every thing you post?
BTW, what legends do you ha
> ""Mr" == "Mr Shawn H Corey" <[EMAIL PROTECTED]> writes:
Mr> Objects can do the same things as closures, which is store and hide data,
Mr> but don't have this problem of having to keep in mind two phases of the
Mr> same code.
But objects have fixed code with variable data. Closures can have
Dr.Ruud wrote:
Why do people who write these books have exercises of little
practical value?
An exercise needs to be educational.
I have worked in programming for 25 years and during that time I have never use
a closure and have never seen one used. I may be harsh in my definitions but
t
Chris schreef:
> #!/usr/bin/perl -w
Toss the -w, and insert a "use warnings;".
> my ($start, $stop) = @_;
> my @starting_directories = @_;
This doesn't do what I think that you think it does.
> my($sec, $min, $hour, $day, $mon, $yr, $dow) = localtime;
Is the start/top related to today?
What
Ok, if anyone is interested, here is my answer:
#!/usr/bin/perl -w
# Testing code for Exercise 6-1. Your task is to write the sub
# gather_mtime_between.
use strict;
use File::Find;
use Time::Local;
my ($start, $stop) = @_;
my @starting_directories = @_;
my @found_items;
sub gather_mtime_betw
Shawn schreef:
> Chris:
>> I'm working on yet another exercise from Intermediate Perl. I've
>> been given a script that searches for files that fall between a two
>> timestamps. For the exercise, I am supposed to write the
>> gather_mtime_between subroutine that will return two references to
>>
Mr. Shawn H. Corey wrote:
Chris wrote:
I'm working on yet another exercise from Intermediate Perl. I've been
given a script that searches for files that fall between a two
timestamps. For the exercise, I am supposed to write the
gather_mtime_between subroutine that will return two references t
Chris wrote:
I'm working on yet another exercise from Intermediate Perl. I've been
given a script that searches for files that fall between a two
timestamps. For the exercise, I am supposed to write the
gather_mtime_between subroutine that will return two references to two
subroutines. One wil
On 8/25/07, Chris <[EMAIL PROTECTED]> wrote:
> if (my $start <= $timestamp <= my $stop){
Until Perl 6, you have to break down chain comparisons like this into
separate comparisons, usually joined with 'and':
if ($start <= $timestamp and $timestamp <= $stop) { ... }
But the real problem
Andy Greenwood wrote:
> I'm writing a script for work that will dig for DNS records for a
> given domain name and put the entries into an array. At the end of the
> digging, it outputs the array elements to the screen, asks if
> everything looks good, and if so, writes them out to the shell and
> b
On 11/16/06, Andy Greenwood <[EMAIL PROTECTED]> wrote:
if (/^$domain.+MX\s+(\d+)\s+(.+)/) {
Because $domain is a string (and not a pattern), interpolating it into
a pattern could cause troubles. First, any metacharacters it contains
may affect the match. But also, is that pattern going
On 11/16/06, Jay Savage <[EMAIL PROTECTED]> wrote:
On 11/16/06, Andy Greenwood <[EMAIL PROTECTED]> wrote:
> I'm writing a script for work that will dig for DNS records for a
> given domain name and put the entries into an array. At the end of the
> digging, it outputs the array elements to the sc
On 11/16/06, Andy Greenwood <[EMAIL PROTECTED]> wrote:
I'm writing a script for work that will dig for DNS records for a
given domain name and put the entries into an array. At the end of the
digging, it outputs the array elements to the screen, asks if
everything looks good, and if so, writes th
On 10/12/2006 11:23 AM, Moon, John wrote:
-Original Message-
From: Gallagher, Tim F (NE) [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 12, 2006 11:55 AM
To: Perl Beginners
Subject: Subroutine returning 2 arrays
From a subroutine I would like to return 2 separate arrays like this
Believe you want to do as a reference otherwise it justs returns the
data as a flat file or stream of data.
Here is a snippet. Would get away from a and b since the $a and $b are
used by sort. Know that it is an array, but would get away from that.
Also use strict and warnings.
#!perl
use strict
-Original Message-
From: Gallagher, Tim F (NE) [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 12, 2006 11:55 AM
To: Perl Beginners
Subject: Subroutine returning 2 arrays
>From a subroutine I would like to return 2 separate arrays like this
sub TEST
{
@a = ("a1","a2","a3","a4","a5","
On 10/12/2006 10:55 AM, Gallagher, Tim F (NE) wrote:
From a subroutine I would like to return 2 separate arrays like this
sub TEST
{
@a = ("a1","a2","a3","a4","a5","a6","a7");
@b = ("b1","b2","b3","b4","b5","b6","b7");
return (@a, @b);
}
my(@lala,@baba) = TEST;
print @lala;
The probl
1 - 100 of 206 matches
Mail list logo