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
In “Learning Perl”, Pg. 116, is found this sentence: Whatever calculation is
last performed in a subroutine is automatically also the return value.
I have a subroutine that (almost) ends with this loop:
foreach my $line (@lines) {
$sum += evaluate($line);
}
What I want to return
> On Mar 29, 2017, at 3:47 PM, Kevin Phair wrote:
>
> Something like
>
> [-Subroutines::ProhibitSubroutinePrototypes]
Thanks. I ran across that myself on perlmaven.com right before I went
to lunch. I was hoping to find a page on CPAN or even the Perl Critic web site
that would list
:
> Does anyone know how to keep Perl Critic from complaining about subroutine
> signatures? I’m getting a massive amount of these types of warnings:
>
> Subroutine prototypes used at line...
>
> It also thinks that postfix dereferencing is a magic variable. Is this
> because P
On 03/29/2017 01:32 PM, SSC_perl wrote:
On Mar 29, 2017, at 10:19 AM, Uri Guttman <mailto:u...@stemsystems.com>> wrote:
i would ask why are you using prototypes?
I’m not using prototypes. I’m using subroutine signatures. Perl
Critic only thinks they are prototypes.
ok, i just
> On Mar 29, 2017, at 10:19 AM, Uri Guttman wrote:
>
> i would ask why are you using prototypes?
I’m not using prototypes. I’m using subroutine signatures. Perl
Critic only thinks they are prototypes.
On 03/29/2017 01:16 PM, SSC_perl wrote:
Does anyone know how to keep Perl Critic from complaining about
subroutine signatures? I’m getting a massive amount of these types of
warnings:
Subroutine prototypes used at line...
i would ask why are you using prototypes? they are rarely useful
Does anyone know how to keep Perl Critic from complaining about
subroutine signatures? I’m getting a massive amount of these types of warnings:
Subroutine prototypes used at line...
It also thinks that postfix dereferencing is a magic variable. Is this
because PC hasn’t been
Naming multiple variables with the same name like you did ($args, %args) is
a
bad idea. because when you want to access the value of the hash %args
($args{FN}) you are accessing in reality what was shifted in the scalar
$args and not the hash %args
because perl use simbolic reference.
here is a li
On Sun, Jan 15, 2017 at 12:45:41PM -0800, al...@myfastmail.com wrote:
> Hi
>
> On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote:
> > I think, you can use this aproach
>
> If I use either of those
>
>
> sub modrec {
> - my %args = %{ shift @_ };
> +
On Sun, Jan 15, 2017, 16:19 wrote:
Hi,
On Sun, Jan 15, 2017, at 01:01 PM, Shawn H Corey wrote:
> > Is there a different, recommended way?
>
> Nothing's wrong. perlcritic does not this valid method, that's all.
>
> TIMTOWTDI (There Is More Than One Way To Do It.)
Hm, ok. As long as it's not wro
Hi Alan
You are unpacking `@_` in a way, but perlcritic doesn't recognise doing it this
way.
I think you'd be better off without dereferencing the hash, and using a slice
to assign your local variables. I would write your subroutine like this
sub modrec {
Hi,
On Sun, Jan 15, 2017, at 01:01 PM, Shawn H Corey wrote:
> > Is there a different, recommended way?
>
> Nothing's wrong. perlcritic does not this valid method, that's all.
>
> TIMTOWTDI (There Is More Than One Way To Do It.)
Hm, ok. As long as it's not wrong/broken in some weird way.
I kep
On Sun, 15 Jan 2017 12:09:53 -0800
al...@myfastmail.com wrote:
> What's wrong with the way I'm unpacking the arguments passed to the
> subroutine,
>
> my %args = %{ shift @_ };
>
> Is there a different, recommended way?
Nothing's wrong. perlcritic does
Hi!
You forgot arrow operator
$args->{'FN'}, not $args{'FN'}
15.01.17 23:45, al...@myfastmail.com пишет:
Hi
On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote:
I think, you can use this aproach
If I use either of those
sub modrec {
- my %args = %{ shift
Hi
On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote:
> I think, you can use this aproach
If I use either of those
sub modrec {
- my %args = %{ shift @_ };
+ my ($args) = @_;
30 my $fn = $args{FN};
Hi!
I think, you can use this aproach
sub modrec {
my ($args) = @_; # or my $args = shift @_; use what you like more
my $fn = $args->{'FN'};
}
15.01.17 23:09, al...@myfastmail.com пишет:
Hi,
I have a simple script with a subroutine that I pass scalar &
Hi,
I have a simple script with a subroutine that I pass scalar & array arguments
to,
#!/usr/bin/perl
use 5.01201;
use strict;
use warnings;
my $this_fn = "input.txt";
my @this_dr = qw(
/path/1
/path/2
On Thu, 08 May 2014 16:54:32 +0400
Jeff Pang wrote:
> Hi,
>
> I created a $dbh object in the main body, and pass it to a
> subroutine, then close the $dbh in the subroutine, does it influence
> the $dbh in the main?
Yes. It's a reference to the same DBI object.
--
To
Hi,
I created a $dbh object in the main body, and pass it to a subroutine, then
close the $dbh in the subroutine, does it influence the $dbh in the main?
$dbh = DBI->connect($data_source, $username, $auth, \%attr);
my_func($dbh);
$dbh->do(something); # will this broke?
sub my_func {
my @animals = @$animals; # dereference
my @digits = @$digits; # dereference
The comment is inaccurate.
Why would you want to copy the arrays?
Because I don't want to change an array by my subroutine, as Shawn H
Corey answered already.
Well, this may or may not be eventual's intentio
On Sat, 07 Sep 2013 14:15:39 +0200
"Dr.Ruud" wrote:
> On 07/09/2013 13:43, Karol Bujaček wrote:
>
> >print Dumper(@_);# just look how the @_ looks like
>
> Consider: print Dumper( \@_ );
>
>
> >my($animals, $digits) = @_;
> >
> >my @animals = @$animals; # dereference
> >
On 07/09/2013 13:43, Karol Bujaček wrote:
print Dumper(@_);# just look how the @_ looks like
Consider: print Dumper( \@_ );
my($animals, $digits) = @_;
my @animals = @$animals; # dereference
my @digits = @$digits; # dereference
The comment is inaccurate.
Why would
On 09/07/2013 01:11 PM, eventual wrote:
Hi,
In the example below, how do I pass @pets and @numbers into the
subroutine so that
@animals = @pets and
@digits = @numbers.
Thanks
my @pets = ('dogs' , 'cats' , 'horses');
my @numbers = (1..10);
&study (@pets
ot;
Sent: Saturday, 7 September 2013 4:41 PM
Subject: How do I pass arrays into a subroutine
Hi,
In the example below, how do I pass @pets and @numbers into the subroutine so
that
@animals = @pets and
@digits = @numbers.
Thanks
my @pets = ('dogs' , 'cats' , 'h
Hi Eventual,
On Sat, 7 Sep 2013 04:11:06 -0700 (PDT)
eventual wrote:
> Hi,
>
> In the example below, how do I pass @pets and @numbers into the subroutine so
> that @animals = @pets and
> @digits = @numbers.
Please look into references and pass the arrays as references. Se
Hi,
In the example below, how do I pass @pets and @numbers into the subroutine so
that
@animals = @pets and
@digits = @numbers.
Thanks
my @pets = ('dogs' , 'cats' , 'horses');
my @numbers = (1..10);
&study (@pets , @numbers);
sub study {
my (
> 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
Hello List,
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(@_);
return abs($x-$y)<180 ? ($x+$y
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
Thank you. I am confused about how to send variables to this ext.pl and get
values (scalars) back into main.pl
another confusion is from web the cgi will run, i want to check cookies in
external subroutine file and redirect to some website based on some condition,
or gives some values back to
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
i want to keep a peice of code which uses CGI and DBIx module in a seperate
file, and want to include it in all my scripts as follows:
require "/path/to/script/file";
I am not sure if the calling program is also using same modules CGI and DBIx
what kind of unknown errors i might get? anyone k
Hi Chris,
On Fri, Jul 13, 2012 at 3:28 AM, Shawn H Corey wrote:
> On 12-07-12 10:25 PM, Chris Stinemetz wrote:
>
>> I have an anonymous array below and would like to know how to pass the
>> first element to a subroutine as a parameter.
>>
>> push @data, [$srt,$
On 12-07-12 10:25 PM, Chris Stinemetz wrote:
I have an anonymous array below and would like to know how to pass the
first element to a subroutine as a parameter.
push @data, [$srt,$srfc,$cfc,$cfcq,$cell,$icell,$isector,$sector];
call to subroutine:
session_attempts($srt);
Thank you in
I have an anonymous array below and would like to know how to pass the
first element to a subroutine as a parameter.
push @data, [$srt,$srfc,$cfc,$cfcq,$cell,$icell,$isector,$sector];
call to subroutine:
session_attempts($srt);
Thank you in advance,
Chris
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
On Jun 7, 2012, at 10:19 PM, Brock wrote:
> Finally to your last question, how is this different than just calling the
> package::sub directly? With a method call the instance variable, in this case
> $catalog, always gets passed as the first parameter to the method. Usually
> people name it $s
On 2012.06.07.20.21, sono...@fannullone.us wrote:
> Would someone be so kind as to explain the following, or at least point
> me to further reading?
>
> $item =
> $main::global->{open}->{catalog}->SurfDB::split_line($main::global->{form}->{'itemid'});
>
> The part I'm having trouble
Would someone be so kind as to explain the following, or at least point
me to further reading?
$item =
$main::global->{open}->{catalog}->SurfDB::split_line($main::global->{form}->{'itemid'});
That's Perl OO programming.
You may want to read this book:
http://shop.oreilly.com/produc
Would someone be so kind as to explain the following, or at least point
me to further reading?
$item =
$main::global->{open}->{catalog}->SurfDB::split_line($main::global->{form}->{'itemid'});
The part I'm having trouble understanding is
"$main::global->{open}->{catalog}->". Wh
[ 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
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
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', v
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
0 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,
>>
>
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
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 k
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.
>
> T
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]}}) {
return 1 if $_ eq
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
ng 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.
Could someone please expand on this as I seem to always have to do
this. If I 'use strict' and 'use warnings' I get
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
>
>> Perl tells you that it has no idea what you mean when you use the
>> bareword mysub.
>>
>>
>> Now you have two options to solve it.
>>
>> 1. &mysub;
>>
>> Using the sigil & you tell Perl that mysub is a subroutine.
>>
>> 2
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
lation errors.
> >
> >
> > Perl tells you that it has no idea what you mean when you use the
> > bareword mysub.
> >
> >
> > Now you have two options to solve it.
> >
> > 1. &mysub;
> >
> > Using the sigil & you tell Perl that
t;mysub" not allowed while "strict subs" in use at ./testsub.pl
> line 6. Execution of ./testsub.pl aborted due to compilation errors.
>
>
> Perl tells you that it has no idea what you mean when you use the
> bareword mysub.
>
>
> Now you have two options to
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
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.
>
> Co
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 & w
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?
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
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 wh
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?
eg:
sub name {
some code here, returning a single value
return 0;
}
&name();
cheers
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>=
subroutine call is made I get the following compilation error:
Global symbol "$cell" requires explicit package name at ./evdo.pl line 279.
Global symbol "$cell" requires explicit package name at ./evdo.pl line 279.
I understand lexical scope, but am having a hard time figuring
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
ow when this subroutine call is made I get the following compilation error:
>
> Global symbol "$cell" requires explicit package name at ./evdo.pl line 279.
> Global symbol "$cell" requires explicit package name at ./evdo.pl line 279.
>
> I understand lexical scope
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 explic
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 name at ./evdo.pl line 279.
Global sym
Thanks a ton!!
Hats off to you for encouragement
On Fri, Nov 4, 2011 at 5:05 PM, Shlomi Fish wrote:
> Hi "a b",
>
> On Fri, 4 Nov 2011 15:18:00 +0530
> a b wrote:
>
> > apologize!!
> >
> > Can you help me to understand how async I/O can help me
> >
>
> What's wrong with the resources in the UR
Hi "a b",
On Fri, 4 Nov 2011 15:18:00 +0530
a b wrote:
> apologize!!
>
> Can you help me to understand how async I/O can help me
>
What's wrong with the resources in the URL I pointed you to? There's also
http://en.wikipedia.org/wiki/Asynchronous_I/O which may be of interest. "The
Gods help
apologize!!
Can you help me to understand how async I/O can help me
Regards
a b
On Thu, Nov 3, 2011 at 9:06 PM, Shlomi Fish wrote:
> Hello a b,
>
> please reply to the list as I specifically request in my signature.
> (Wretched
> gmail.com.) I'm CCing the list.
>
> On Thu, 3 Nov 2011 16:15:11
Hello a b,
please reply to the list as I specifically request in my signature. (Wretched
gmail.com.) I'm CCing the list.
On Thu, 3 Nov 2011 16:15:11 +0530
a b wrote:
> Thanks Shlomi!!
>
> I am not sure about async I/O?
>
> any pointers about this one. It is new to me so far
>
See the links
On Thu, 3 Nov 2011 06:49:36 +0100
timothy adigun <2teezp...@gmail.com> wrote:
> Hi a b,
>
> a b wrote:
>
> > Hi all,
> >
> > i need to track down how much time each function is taking and anlyze if
> > threads can help
> >
> > do we have any such function??
> >
>
> **You can use ** use Benchma
Hi a b,
a b wrote:
> Hi all,
>
> i need to track down how much time each function is taking and anlyze if
> threads can help
>
> do we have any such function??
>
**You can use ** use Benchmark qw(:all) **.
>From your CLI you can do: perldoc benchmark,
or if you not like reading from the command
Hi all,
i need to track down how much time each function is taking and anlyze if
threads can help
do we have any such function??
On Fri, Jul 29, 2011 at 04:05:26PM +0200, Dr.Ruud wrote:
> On 2011-07-28 00:45, C.DeRykus wrote:
>
> > open( ... ) or warn "..." and return;
>
> Here you are assuming that warn always returns true. It actually
> does, even if the device that it write to is full, but I don't think
> that is
On 2011-07-28 00:45, C.DeRykus wrote:
open( ... ) or warn "..." and return;
Here you are assuming that warn always returns true. It actually does,
even if the device that it write to is full, but I don't think that is
documented ...
--
Ruud
--
To unsubscribe, e-mail: beginners-uns
On Wed, Jul 27, 2011 at 9:30 AM, Rob Dixon wrote:
> What exactly is wrong with "or do {...}"?
>
> I believe it is the best option simply because is is comparable to the
> common "open ... or die $!" idiom. The do is there only so that a
> warning can be issued as well as the return
There's nothin
On Jul 27, 9:30 am, rob.di...@gmx.com (Rob Dixon) wrote:
> ...
> > Well, one thing I dislike about it is that it is using "or do {...}"
> > instead of
> > an "if ( ) { ... }". And I did mention something similar.
>
> What exactly is wrong with "or do {...}"?
>
> I believe it is the best option sim
On 27/07/2011 08:51, Shlomi Fish wrote:
On Tue, 26 Jul 2011 16:58:47 +0100 Rob Dixon wrote:
On 26/07/2011 16:39, Nikolaus Brandt wrote:
On Tue, Jul 26, 2011 at 01:01:54PM +0300, Shlomi Fish wrote:
Another option would be to use eval { ... } and $@ to trap exceptions:
Thank you all for the
Hello Nikolaus Brand,
You can try these:
1. ) Instead of "die" in your code use "warn", then return from the
subroutine,
2.) Intstead of hard coding the path and file in your program i.e
["$basedir/$userdir/$outfile" ], ask the user to input the path and file,
as
Hi Rob,
On Tue, 26 Jul 2011 16:58:47 +0100
Rob Dixon wrote:
> On 26/07/2011 16:39, Nikolaus Brandt wrote:
> > On Tue, Jul 26, 2011 at 01:01:54PM +0300, Shlomi Fish wrote:
> >>
> >> Another option would be to use eval { ... } and $@ to trap exceptions:
> >
> > Thank you all for the replies.
> >
>
On 26/07/2011 16:39, Nikolaus Brandt wrote:
On Tue, Jul 26, 2011 at 01:01:54PM +0300, Shlomi Fish wrote:
Another option would be to use eval { ... } and $@ to trap exceptions:
Thank you all for the replies.
I used the above mentioned eval-$@ solution which was absolutely working fine.
I t
Hi,
On Tue, Jul 26, 2011 at 01:01:54PM +0300, Shlomi Fish wrote:
> Hi Nikolaus,
>
> On Tue, 26 Jul 2011 11:32:19 +0200
> Nikolaus Brandt wrote:
>
> > Hi,
> >
> > I'm currently writing a script which contains a subroutine to write
> > dat
Nikolaus Brandt wrote:
Hi,
Hello,
I'm currently writing a script which contains a subroutine to write
data to files.
Currently I use
open $fh, '>', "$basedir/$userdir/$outfile" or die "Can't write: $!\n";
which has the disadvantage, that the w
El 26/07/2011 12:01, Shlomi Fish escribió:
Another option would be to use eval { ... } and $@ to trap exceptions:
http://perl-begin.org/tutorials/perl-for-newbies/part4/#page--exceptions--DIR
Important to remember that "open" won't raise an exception if you are
not using the "autodie" pragma
Hi Nikolaus,
On Tue, 26 Jul 2011 11:32:19 +0200
Nikolaus Brandt wrote:
> Hi,
>
> I'm currently writing a script which contains a subroutine to write
> data to files.
> Currently I use
> open $fh, '>', "$basedir/$userdir/$outfile" or die "Can
1 - 100 of 1036 matches
Mail list logo