Thanks for everyone's assistance, I think I have my answer. I will be looking
closer at the comments.
cheers
From: Michael Rasmussen
To: beginners@perl.org
Sent: Tuesday, 17 April 2012 11:01 PM
Subject: Re: & and subroutine
And for what it
On 04/17/2012 08:30 AM, Manfred Lotz wrote:
On Tue, 17 Apr 2012 12:27:32 +0100
Gary Stainburn wrote:
On Monday 16 April 2012 15:20:35 Paul Johnson wrote:
On Mon, Apr 16, 2012 at 06:53:53AM -0700, Paul.G wrote:
Hi All
Have a question, is it good coding practice to use a& when
calling a subr
On 04/17/2012 07:03 AM, 'lesleyb' wrote:
On Mon, Apr 16, 2012 at 04:20:35PM +0200, Paul Johnson wrote:
On Mon, Apr 16, 2012 at 06:53:53AM -0700, Paul.G wrote:
Hi All
Have a question, is it good coding practice to use a& when calling a
subroutine, or it is not required, or it doesn't matter?
On Tue, Apr 17, 2012 at 9:43 AM, Gary Stainburn
wrote:
> On Tuesday 17 April 2012 13:30:59 Manfred Lotz wrote:
>>
>> One example is this:
>>
>> #! /usr/bin/perl
>>
>> use strict;
>> use warnings;
>>
>> mysub;
>>
>> sub mysub {
>> print "Hi there\n";
>> }
>>
>> If you run this you get an error:
>
On Tuesday 17 April 2012 15:13:40 Manfred Lotz wrote:
> You have
> sub mysub() {
>
> instead of
>
> sub mysub {
>
> which is the correct way.
Thank you. I can't believe how many years I've been getting that one wrong.
Gary
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional
On Tue, 17 Apr 2012 14:43:01 +0100
Gary Stainburn wrote:
> On Tuesday 17 April 2012 13:30:59 Manfred Lotz wrote:
> >
> > One example is this:
> >
> > #! /usr/bin/perl
> >
> > use strict;
> > use warnings;
> >
> > mysub;
> >
> > sub mysub {
> > print "Hi there\n";
> > }
> >
> > If you run this y
On Tuesday 17 April 2012 13:30:59 Manfred Lotz wrote:
>
> One example is this:
>
> #! /usr/bin/perl
>
> use strict;
> use warnings;
>
> mysub;
>
> sub mysub {
> print "Hi there\n";
> }
>
> If you run this you get an error:
> Bareword "mysub" not allowed while "strict subs" in use at ./testsub.pl
And for what it's worth.
113. Call subroutines with parentheses but without a leading &
That's from Damian Conway's Perl Best Practices
A quick reference to the 256 guidelines is found at
http://refcards.com/docs/vromansj/perl-best-practices/refguide.pdf
And a bit of luck, the entire chapter on s
On Tue, Apr 17, 2012 at 02:30:59PM +0200, Manfred Lotz wrote:
> > Could someone please expand on this as I seem to always have to do
> > this. If I 'use strict' and 'use warnings' I get errors if I don't.
> >
>
> One example is this:
>
> #! /usr/bin/perl
>
> use strict;
> use warnings;
>
> mys
On 12-04-17 08:30 AM, Manfred Lotz wrote:
On Tue, 17 Apr 2012 12:27:32 +0100
Gary Stainburn wrote:
> On Monday 16 April 2012 15:20:35 Paul Johnson wrote:
> > On Mon, Apr 16, 2012 at 06:53:53AM -0700, Paul.G wrote:
> > > Hi All
> > >
> > > Have a question, is it good coding practic
On Tue, 17 Apr 2012 12:27:32 +0100
Gary Stainburn wrote:
> On Monday 16 April 2012 15:20:35 Paul Johnson wrote:
> > On Mon, Apr 16, 2012 at 06:53:53AM -0700, Paul.G wrote:
> > > Hi All
> > >
> > > Have a question, is it good coding practice to use a & when
> > > calling a subroutine, or it is not
On Monday 16 April 2012 15:20:35 Paul Johnson wrote:
> On Mon, Apr 16, 2012 at 06:53:53AM -0700, Paul.G wrote:
> > Hi All
> >
> > Have a question, is it good coding practice to use a & when calling a
> > subroutine, or it is not required, or it doesn't matter?
>
> It's good practice not to use it u
On Mon, Apr 16, 2012 at 04:20:35PM +0200, Paul Johnson wrote:
> On Mon, Apr 16, 2012 at 06:53:53AM -0700, Paul.G wrote:
> > Hi All
> >
> > Have a question, is it good coding practice to use a & when calling a
> > subroutine, or it is not required, or it doesn't matter?
>
> It's good practice not
On Mon, Apr 16, 2012 at 06:53:53AM -0700, Paul.G wrote:
> Hi All
>
> Have a question, is it good coding practice to use a & when calling a
> subroutine, or it is not required, or it doesn't matter?
It's good practice not to use it unless you understand exactly why you
would need to use it.
--
14 matches
Mail list logo