> "FH" == Feng He writes:
FH> You will always be able to check the return status of a method call,
FH> something like:
FH> my $obj = Some::Module->new
FH> or die "can't create object from Some::Module";
please learn to bottom post. i now have to comment on your answer and
also
> "OL" == Olga Lee writes:
OL> Oh, thank you!!
OL> Now I understand, the point is that if don't suppose to give an
OL> argument to function, i should declare it as function() with brackets.
that is actually the wrong point. don't use prototypes unless there is a
major benefit to using
You will always be able to check the return status of a method call,
something like:
my $obj = Some::Module->new
or die "can't create object from Some::Module";
Regards.
On Sat, Aug 13, 2011 at 7:58 AM, Jeffrey Joh wrote:
>
> I'd like to include code so that if I get the following error
I'd like to include code so that if I get the following error, the script will
just ignore it and keep running:
"Can't call method "attr" on an undefined value at abcde.pl line 2"
Does anyone know of such a code?
Jeff
--
To unsubscribe, e-mail: be
Randal L. Schwartz wrote:
"John" == "John W Krahn" writes:
John> split() uses @_ by default so you could just say:
That's deprecated though, if not already gone. (Looks gone in Perl
5.14.) It was a readily-admitted misfeature.
Unless you're playing golf. :-)
John
--
Any intelligent f
Oh, thank you!!
Now I understand, the point is that if don't suppose to give an
argument to function, i should declare it as function() with brackets.
Thanks again!
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.pe
> "John" == "John W Krahn" writes:
John> split() uses @_ by default so you could just say:
That's deprecated though, if not already gone. (Looks gone in Perl
5.14.) It was a readily-admitted misfeature.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
http:/
It was the absence of the 'use strict;' that permitted the execution.
Now fails if 'use strict;' is added to code and 'my' is missing.
Added 'use strict;' and 'my'.
Cheers!
From: Jim Gibson
To: beginners@perl.org
Sent: Fri, 12 August, 2011 14:13:26
Subject: Re
got it ... thank you. cheers!
From: Brandon McCaig
To: Tony Esposito
Cc: beginners@perl.org
Sent: Fri, 12 August, 2011 14:08:52
Subject: Re: while(@data) works but why
On Fri, Aug 12, 2011 at 3:02 PM, Tony Esposito
wrote:
> .
> .
> .
> while(@dat = $sth->fe
On 8/12/11 Fri Aug 12, 2011 12:02 PM, "Tony Esposito"
scribbled:
> .
> .
> .
> while(@dat = $sth->fetchrow) {
> print "@dat\n";
> .
> .
> .
>
> This code works yet there is no 'my @dat' defined anywhere in the code.
> Using Perl 5.8.x - 5.14.x
>
> Q: Why does the variable @dat not nee
On Fri, Aug 12, 2011 at 3:02 PM, Tony Esposito
wrote:
> .
> .
> .
> while(@dat = $sth->fetchrow) {
> print "@dat\n";
> .
> .
> .
>
> This code works yet there is no 'my @dat' defined anywhere in the code.
> Using Perl 5.8.x - 5.14.x
>
> Q: Why does the variable @dat not need a 'my' in front
.
.
.
while(@dat = $sth->fetchrow) {
print "@dat\n";
.
.
.
This code works yet there is no 'my @dat' defined anywhere in the code.
Using Perl 5.8.x - 5.14.x
Q: Why does the variable @dat not need a 'my' in front?
Cheers!
On 12/08/11 02:22 PM, Robert Wohlfarth wrote:
On Fri, Aug 12, 2011 at 7:03 AM, TimKapHwan wrote:
#!/usr/bin/perl -w
sub func
{
return 10;
}
print func * 5, "\n";
Perl interprets that command like this:
print func(*5, "\n");
The "*5" and "\n" become parameters to func. Change the code like
On Fri, Aug 12, 2011 at 7:03 AM, TimKapHwan wrote:
> #!/usr/bin/perl -w
> sub func
> {
> return 10;
> }
> print func * 5, "\n";
>
Perl interprets that command like this:
print func(*5, "\n");
The "*5" and "\n" become parameters to func. Change the code like this:
print func() * 5, "\n";
--
Ro
On 12/08/11 08:03 AM, TimKapHwan wrote:
Hello all!
My first question in this group =)
Can someone explain me why this work fine:
#!/usr/bin/perl -w
sub func
{
return 10;
}
print 5 * func, "\n";
The answer is 50. Good!
But then i change func and 5:
#!/usr/bin/perl -w
sub func
{
return 10;
On 12/08/2011 18:52, Rob Dixon wrote:
> On 12/08/2011 00:17, siegfr...@heintze.com wrote:
>> This works! Is there a way to do it with less typing? How can I do it
>> without creating a temporary variable "@p"?
>> Thanks,
>> siegfried
>>
>> find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/"; r
Hello all!
My first question in this group =)
Can someone explain me why this work fine:
#!/usr/bin/perl -w
sub func
{
return 10;
}
print 5 * func, "\n";
The answer is 50. Good!
But then i change func and 5:
#!/usr/bin/perl -w
sub func
{
return 10;
}
print func * 5, "\n";
The output is 10 Wi
On 12/08/2011 00:17, siegfr...@heintze.com wrote:
This works! Is there a way to do it with less typing? How can I do it
without creating a temporary variable "@p"?
Thanks,
siegfried
find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/"; rename $_,
"./$p[$#p].txt" } '
find /xyz -exec perl -e
On Thu, Aug 11, 2011 at 7:17 PM, wrote:
> find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/"; rename $_,
> "./$p[$#p].txt" } '
If I'm reading this right then it looks like you're trying to
recursively move all files in /xyz into the current directory.
Probably don't need Perl for that.
fi
19 matches
Mail list logo