ttf',
>> pointsize=>40,fill=>'green',text=>$text);
>>
>> # Perhaps you want to extract all the pixel intensities from an image and
>> write them to STDOUT
>> @pixels = $image->GetPixels(map=>'I',
>> height=>$height,width=>$w
m to STDOUT
> @pixels = $image->GetPixels(map=>'I',
> height=>$height,width=>$width,normalize=>true);
> binmode STDOUT;
> print pack('B*',join('',@pixels));
>
> # Other clever things you can do with a PerlMagick objects include
> $i = &
The issue isn't having the method, the issue is calling it on an unblessed
reference. Can you show the code that gives this problem?
Btw, my bet is that it's not a matter of having PDL's method. You would use
PDL for number crunching, not gif animation. :-)
David
On Fri, Feb 4,
result is wrong.
Can't call method "Convolve" on unblessed reference at gifaninmation.pl
> line 47.
>
I don't know in what part I am confused.
On Fri, Feb 4, 2022 at 8:34 AM Andrew Solomon wrote:
> Is this what you're looking for?
>
> https://metacpan.or
Is this what you're looking for?
https://metacpan.org/pod/PDL::ImageND
On Fri, Feb 4, 2022 at 2:30 PM William Torrez Corea
wrote:
> I'm using cpanm trying to find a method that contains the function
> convolve but I only found the method Imager.
>
> https://metacpan.org/pod/Imager
>
> When I t
I'm using cpanm trying to find a method that contains the function convolve
but I only found the method Imager.
https://metacpan.org/pod/Imager
When I try to declare the method and use it in the code, the result is
always wrong.
I am using the following libraries:
>
>
>
> *#!/usr/local/bin/perl
Artifactory-Client: zero length file uploads
https://rt.cpan.org/Public/Bug/Display.html?id=97772
'expect' => '100-continue' undefined value as a SCALAR reference #63
https://github.com/libwww-perl/libwww-perl/issues/63
if(defined($wbits)) is giving me can't use and
Thank you. The useful note about CORE, in particular, is new to me.
cts
--- On Sun, 6/24/12, Rob Dixon wrote:
> From: Rob Dixon
> Subject: Re: how to do a reference to a func in Math::Trig
> To: "Perl Beginners"
> Cc: "Charles Smith"
> Date: Sunday, June
On 24/06/2012 19:51, Rob Dixon wrote:
or by aliasing the current package's 'sin' and 'cos' subroutines with
the CORE functions:
use strict;
use warnings;
use Math::Trig;
BEGIN {
no warnings 'once';
*sin = \&CORE::sin;
*cos = \&CORE::cos;
}
f
so I can use this, my "siggen" pgm with gnuplot:
plot "<(./siggen -f cos -p 2 -n66 )" lc 1
to get a nice curve.
Unfortunately, though, I was only able to get it to work as symbolic reference.
First I tried:
$f = \&Math::Complex::$func;
Scalar found where
h gnuplot:
plot "<(./siggen -f cos -p 2 -n66 )" lc 1
to get a nice curve.
Unfortunately, though, I was only able to get it to work as symbolic reference.
First I tried:
$f = \&Math::Complex::$func;
Scalar found where operator expected at ./siggen line 194, near
&
Charles Smith wrote:
[snip]
>
> But this pgm fails:
>
> #!/usr/bin/env perl
> use Math::Trig;
> my $a = \&Math::Trig::cos;
> &$a(0);
>
> Undefined subroutine &Math::Trig::cos called at modfunctor line 7.
>
The cos sub is defined in Math::Complex, which Math::Trig loads.
Try this:
use strict;
us
Hello Shawn, thank you for answering.
I'm sorry, I was a bit sloppy with my example and so maybe unclear about my
question ...
It's not about the precise syntax of getting a reference to a subroutine, but
rather a subroutine in a module.
For example, this pgm is clear:
#!/usr/bi
On 12-06-23 10:12 AM, Charles Smith wrote:
I'm experimenting with Math::Trig and would like to be able to pass the
function in as a parameter:
$f = $opts{f} || &sin;
$f = $opts{f} || \&sin;
See `perldoc perlreftut` and `perldoc perlref`.
--
Just my 0.0002 million dollars worth,
&Math::Trig::sin;
Undefined subroutine &Math::Trig::sin called at (eval 10)...
$f = \&sin;# just delays the problem
etc.
Can anyone tell me how to take a reference to func in a module?
TIA
cts
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
Fo
On May 20, 2012, at 8:28 AM, Shlomi Fish wrote:
> The problem is that «$self->animals» returns an (unblessed) array reference
> and
> not the list of individual animals, so you should do something like:
>
> for my $animal (@{ $self->animals }) {
Thanks, Shlomi. T
On Sun, May 20, 2012 at 21:44:29 -0400 , John SJ Anderson wrote:
> On Sunday, May 20, 2012 at 9:28 PM, Peter Scott wrote:
> > On Sun, 20 May 2012 18:28:10 +0300, Shlomi Fish wrote:
> > > Note that I think I saw a way to return the flattened array in Moose,
> > > but I don't remember the specifics.
On Sunday, May 20, 2012 at 9:28 PM, Peter Scott wrote:
> On Sun, 20 May 2012 18:28:10 +0300, Shlomi Fish wrote:
> > Note that I think I saw a way to return the flattened array in Moose,
> > but I don't remember the specifics.
> >
>
>
> auto_deref => 1
>
… which is semi-deprecated/recommende
On Sun, 20 May 2012 18:28:10 +0300, Shlomi Fish wrote:
> Note that I think I saw a way to return the flattened array in Moose,
> but I don't remember the specifics.
auto_deref => 1
--
Peter Scott
http://www.perlmedic.com/ http://www.perldebugged.com/
http://www.informit.com/store/product.asp
Hi Marc,
On Sat, 19 May 2012 20:09:00 -0700
sono...@fannullone.us wrote:
> I'm trying the following code from Programming Perl, but I'm get the
> error "Can't call method "type" on unblessed reference at untitled text 10
> line 23". I
I'm trying the following code from Programming Perl, but I'm get the
error "Can't call method "type" on unblessed reference at untitled text 10 line
23". I've checked the errata page, but there's nothing listed for it.
Searching on the
On 01/13/2012 07:25 PM, Parag Kalra wrote:
my $obj = FooBar->new;
$obj->{'new_key'} = 'some_value'
Now I am not sure if that is the correct way of inserting a new data
structure into an already bless reference
1. FooBar may or may not be implemented as a hashref.
w I am not sure if that is the correct way of inserting a new data
structure into an already bless reference
My aim to use this data structure across the script and FooBar through the
object -$obj once added.
This could cause problems if a new version of FooBar starts using
new_key. Instead, creat
于 2012-1-14 11:25, Parag Kalra 写道:
use FooBar;
my $obj = FooBar->new;
Do something
...
$obj->{'new_key'} = 'some_value'
Now I am not sure if that is the correct way of inserting a new data
structure into an already bless reference
I don't thin
ay of inserting a new data
structure into an already bless reference
My aim to use this data structure across the script and FooBar through the
object -$obj once added.
>> Unless you really want to change your data, use map().
>>
>
> Ruud didn't say that you shouldn't change the data, only that you should
> use map unless that was what you wanted. Who knows what the OP wants.
>
> Rob
Sorry for the delay.
What Shlomi Fish mentioned was I wanted. Thanks for all
On 20/11/2011 04:14, Chris Charley wrote:
Well, if Dr Ruud is right, and you shouldn't replace the undefs in the
original arrays, then the following program wouldn't be correct. It
changes the original array (data).
On 20/11/2011 00:23, Dr.Ruud wrote:
Unless you really want to change your da
"Mohan L" wrote in message
news:cadihtmt4rqntknjlgsimpgqv9xuc89dryhtx00ctwbknxwd...@mail.gmail.com...
Dear all,
#!/usr/bin/env perl
#dummy.pl
use strict;
use warnings;
use Data::Dumper;
my $ref_to_AoA = [
[ "fred", "barney",undef,"pebbles", "bambam", "dino", ],
[ "homer",und
On 19/11/2011 18:21, Mohan L wrote:
Dear all,
#!/usr/bin/env perl
#dummy.pl
use strict;
use warnings;
use Data::Dumper;
my $ref_to_AoA = [
[ "fred", "barney",undef,"pebbles", "bambam", "dino", ],
[ "homer",undef,"bart",undef, "marge", "maggie", ],
[ "george", "jane",u
On 2011-11-19 19:21, Mohan L wrote:
But What I want is, I want to replace all 'undef' to a string 'foo'.
Unless you really want to change your data, use map().
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://l
Hi Mohan,
On Sat, 19 Nov 2011 23:51:19 +0530
Mohan L wrote:
> Dear all,
>
> #!/usr/bin/env perl
> #dummy.pl
> use strict;
> use warnings;
> use Data::Dumper;
>
> my $ref_to_AoA = [
> [ "fred", "barney",undef,"pebbles", "bambam", "dino", ],
> [ "homer",undef,"bart",undef, "marge
Dear all,
#!/usr/bin/env perl
#dummy.pl
use strict;
use warnings;
use Data::Dumper;
my $ref_to_AoA = [
[ "fred", "barney",undef,"pebbles", "bambam", "dino", ],
[ "homer",undef,"bart",undef, "marge", "maggie", ],
[ "george", "jane",undef, "elroy",undef,"judy", ],
];
what is happening here. The class name is returned
but
exactly how are the $value reference and $class related?
Read the documentation for bless: 'perldoc -f bless'
bless REF,CLASSNAME
bless REF
This function tells the thingy referenced by
returned
but
exactly how are the $value reference and $class related?
TYIA, blawson
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
,'test');
}
On Thu, Oct 6, 2011 at 1:03 PM, Jeffrey Joh wrote:
>
> Thank you for your help Rob.
>
>
>
> How can I write a code to go to next iteration of the foreach loop if there
> is a "Cannot bind a reference" error?
>
>
> Thanks,
>
> Je
Thank you for your help Rob.
How can I write a code to go to next iteration of the foreach loop if there is
a "Cannot bind a reference" error?
Thanks,
Jeffrey
> Date: Sun, 2 Oct 2011 01:54:38 +0100
> From: rob.di...@gmx.com
On 01/10/2011 23:16, Jeffrey Joh wrote:
>
> I am trying to run an insert statement with DBI.
>
> $dbh->do(q{insert into zillow_table values
> (?,?,?,?,?,?,?,?)},undef,($homeid,$code,$text,$pid,$street,$city,$state,$zlastupdated));
>
> However, I get "Cannot bind
Hello,
I am trying to run an insert statement with DBI.
$dbh->do(q{insert into zillow_table values
(?,?,?,?,?,?,?,?)},undef,($homeid,$code,$text,$pid,$street,$city,$state,$zlastupdated));
However, I get "Cannot bind a reference" error. Why does that occur? $dbh is
part
ust like in case it would have used %parameters instead of @parameters...
it doesn't break.
Octavian
- Original Message -
From: "Shlomi Fish"
To: "Octavian Rasnita"
Cc:
Sent: Sunday, August 07, 2011 3:52 PM
Subject: Re: Using an undefined value as a hash ref
Agent->new;
> my $res = $ua->get( 'http://www.google.com/', %$fields );
>
> This script runs with no errors, although the variable $fields is undefined
> and it is used as a hash reference and I don't understand why.
>
> If I use it in the following line however,
undefined and
it is used as a hash reference and I don't understand why.
If I use it in the following line however, it gives the error "Can't use an
undefined value as a HASH reference":
my %params = %$fields;
Does anyone have an explanation why in the first example it work
On 31/07/2011 00:55, Rob Dixon wrote:
It may be helpful here to read and understand
perldoc "What is the difference between a list and an array"
That should be
perldoc -q "What is the difference between a list and an array"
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
F
passing a reference to it. A reference to anything is a
scalar. If you're a C programmer you can think of a reference as a pointer
(sort of).
is that still true? date on website is 2003...
I think this thread is getting a little confused. The page you refer to
is very out of date, but in any
rmalized by context rule.
>>
>> @voo = ("boon", 12, "man", 88);
>> %coo = @voo;
>> my $line = "";
>> while(my ($key, $val) = each %coo){
>> $line.="$key => $val\n";
>> }
>> print $line;
>>
>> On Sat, Ju
othy adigun <2teezp...@gmail.com>wrote:
>
>> Hi Rajeev,
>> with the link you provided, the statement "In Perl, you can pass only one
>> kind of argument to a subroutine: a scalar... a pointer (sort of)." was
>> made
>> Reference sub-topic. So, it
reference to it. A reference to anything is a
scalar. If you're a C programmer you can think of a reference as a pointer
(sort of).
is that still true? date on website is 2003...
On that web page it says:
NOTE: Modern Perl versions (5.003 and newer) enable you to do function
protot
e
> kind of argument to a subroutine: a scalar... a pointer (sort of)." was
> made
> Reference sub-topic. So, it will not be a total truth that one can pass
> "only" one kind of argument to subroutine.
> Generally in perl the subroutrine default argument is an array &
g->{ 'one' } and $thing->{ 'two' } just like you would
$ref outside your function. And modifying the reference shows up everywhere.
That's it.
On Jul 29, 2011 6:58 PM, "Rajeev Prasad" wrote:
> Hello,
>
> from here: http://www.troubleshooters.com/codec
Hi Rajeev,
with the link you provided, the statement "In Perl, you can pass only one
kind of argument to a subroutine: a scalar... a pointer (sort of)." was made
Reference sub-topic. So, it will not be a total truth that one can pass
"only" one kind of argument to subroutin
ther kind of argument, you need to convert it to a scalar. You
> do that by passing a reference to it. A reference to anything is a
> scalar. If you're a C programmer you can think of a reference as a pointer
> (sort of).
>
> is that still true? date on website is 2003...
Hello,
from here: http://www.troubleshooters.com/codecorn/littperl/perlsub.htm
i found:
In Perl, you can pass only one kind of argument to a subroutine: a scalar.
To pass any other kind of argument, you need to convert it to a scalar. You
do that by passing a reference to it. A reference to
rnings; use XML::XPath;"
Trying to get value for:
$ha = $xPath->findnodes('//job');
Error:
Can't call method "findnodes" on unblessed reference at line
.
Output from Data::Dumper follows:
$VAR1 = {
'object' => [
{
On Wed, May 18, 2011 at 7:55 PM, Rob Dixon wrote:
> I allow myself to be wrong, but I have no wish to draw others along a
> wrong line.
>
I agree with your sentiment. Lets end this thread now, thank you.
--
Casey West
> "RD" == Rob Dixon writes:
RD> On 18/05/2011 23:33, Uri Guttman wrote:
>> "KW" == Kenneth Wolcott writes:
>>> Rob Dixon wrote:
>>>
>>> Please grow up and ask Perl questions. It looks to me as if you are as
>>> silly as each other. I certainly wouldn't employ either of you.
>>
On 18/05/2011 23:33, Uri Guttman wrote:
"KW" == Kenneth Wolcott writes:
>> Rob Dixon wrote:
Please grow up and ask Perl questions. It looks to me as if you are as
silly as each other. I certainly wouldn't employ either of you.
I also wonder if you 'Kenneth Wolcott' and your friend are the
> "RD" == Rob Dixon writes:
RD> I usually sign 'HTH' and I always hope I have helped. A few people have
RD> disagreed with me tonight; and while that leaves me wondering whether I
RD> have been right, I also wonder why comments here are either negative or
RD> non-existent.
RD> I al
d off base.
the OP posted the code INCLUDING the Ec use line. rob coops never
guessed anything. he may have replied to a different post but he saw the
code that the OP posted. look at this:
---
From: Kenneth Wolcott
Subject: Re: Can't call method "findnodes" on unbl
> "RD" == Rob Dixon writes:
RD> If that is the true situation then I am happy to apologize, but even so
RD> the question is not a Perl one, as no one can debug what is inaccessible
RD> to him.
it doesn't MATTER his situation. he asked a perl question. maybe it
wasn't worded well. mayb
ings; use XML::XPath;"
You don't trust your partner. We have no idea whether or not the
programs have strict or warnings in force, or whether XML::XPath is
available.
Trying to get value for:
$ha = $xPath->findnodes('//job');
Error:
Can't call method "findnodes
On 18/05/2011 22:58, Jim Gibson wrote:
On 5/18/11 Wed May 18, 2011 2:25 PM, "Rob Dixon" scribbled:
Holy smokes, Rob. That response is totally inappropriate for a beginners
list. I saw nothing wrong with Kenneth's question, except we needed more
information to help him. I think you owe Kenneth
Rob, buy a one-way express train ticket to hell.
On Wed, May 18, 2011 at 15:53, Rob Dixon wrote:
> On 18/05/2011 22:37, Kenneth Wolcott wrote:
>
>> On Wed, May 18, 2011 at 14:25, Rob Dixon wrote:
>>
>>>
>>> That looks fine, except that all you have printed is a hash of data. It
>>> isn't blesse
> "RD" == Rob Dixon writes:
RD> You are always welcome to any help that we are able to offer here,
RD> but please look first at your character issues before you try to
RD> write software. We are quite happy to accept innocent failure, but
RD> as long as all we have is lies to work wi
On 18/05/2011 22:37, Kenneth Wolcott wrote:
On Wed, May 18, 2011 at 14:25, Rob Dixon wrote:
That looks fine, except that all you have printed is a hash of data. It
isn't blessed and so it isn't an object.
Please grow up and ask Perl questions. It looks to me as if you are as
silly as each oth
> "RD" == Rob Dixon writes:
RD> OK, so what happened here guys?
you went way out of line.
RD> Rob, why did you assume to 'use Ec' when it has never been
RD> mentioned before on this thread? You also seem to have a lot of
RD> insight into the problem before the mess of its declaratio
nce otherwise, your colleague is telling the truth.
Trying to get value for:
$ha = $xPath->findnodes('//job');
You have shown no code for the derivation of $xPath, or the declaration of
$ha.
Error:
Can't call method "findnodes" on unblessed reference at line
.
Wh
> "KW" == Kenneth Wolcott writes:
>> Please grow up and ask Perl questions. It looks to me as if you are as
>> silly as each other. I certainly wouldn't employ either of you.
>>
>> I also wonder if you 'Kenneth Wolcott' and your friend are the same
>> person. Since your name sounds
> "KW" == Kenneth Wolcott writes:
KW> my $ec = Ec->new or die "Can not create Ec object $!\n";
KW> my $xPath;
KW> $xPath = $ec->findObjects('job');
KW> print Dumper($xPath);
well it is pretty obvious from that. the dumper shows NO blessing so the
call to findObjects didn't return a
> "RC" == Rob Coops writes:
RC> ps, you might want to besides the rules to always use strict and
RC> warnings also implement a rule that before opening of a file one
RC> always checks if it exists, and can be opened for the purposes you
RC> need it for (read only will not do if you wa
On 5/18/11 Wed May 18, 2011 2:25 PM, "Rob Dixon"
scribbled:
> That looks fine, except that all you have printed is a hash of data. It
> isn't blessed and so it isn't an object.
>
> Please grow up and ask Perl questions. It looks to me as if you are as
> silly as each other. I certainly wouldn
> :-) Guess it is getting late in England as well then :-)
>
> Anyway...
>
> use strict;
> use warnings;
>
> use Ec;
> use XML::XPath;
> use Data::Dumper;
>
> my $ec = Ec->new or die "Can not create Ec object $!\n";
> my $xPath;
> $xPath = $ec->findObjects('job');
> print Dumper($xPath);
> #my $ha
7;t told him the relevant facts.
>
>
>He claims this: "use strict; use warnings; use XML::XPath;"
>>
>
> Until you have evidence otherwise, your colleague is telling the truth.
>
>
> Trying to get value for:
>> $ha = $xPath->findnodes('//job&
aven't told him the relevant facts.
>
>
>He claims this: "use strict; use warnings; use XML::XPath;"
>>
>
> Until you have evidence otherwise, your colleague is telling the truth.
>
>
> Trying to get value for:
>> $ha = $xPath->findnodes('/
On 18/05/2011 22:21, Kenneth Wolcott wrote:
Should he be using the XML::XPath in OO form and instead of direct
assignment?
There's no file I/O here; perhaps there was an error at the findObjects
call?
Here is a minimized version of the script which illustrates the problem.
use strict;
use war
27;//job');
You have shown no code for the derivation of $xPath, or the declaration
of $ha.
Error:
Can't call method "findnodes" on unblessed reference at line
.
Why are you hiding from us when we have no code? That
also makes sense with the rest of your mail, whic
> Hi Kenneth,
>
> I think the error is clear on what is going wrong: *Error: Can't call
> method "findnodes" on unblessed reference at line .
> *
> *
> *
> When you colleague calls: $xPath->findnodes('//job');
>
> Perl tels him that $xPath
ation on Linux and Windows).
>
> He claims this: "use strict; use warnings; use XML::XPath;"
>
> Trying to get value for:
> $ha = $xPath->findnodes('//job');
>
> Error:
> Can't call method "findnodes" on unblessed reference at line
>
alue for:
$ha = $xPath->findnodes('//job');
Error:
Can't call method "findnodes" on unblessed reference at line
.
Output from Data::Dumper follows:
$VAR1 = {
'object' => [
{
'objectId' =&
At 22:33 + 28/02/2011, Rob Dixon wrote:
The complete program is below.
HTH,
Rob
use strict;
use warnings;
my %HoA;
while ( ) {
my ($swit, $server, $ip_range) = split;
my ($b_real_ip, $b_ip, $e_ip) = $ip_range =~
/(\d+\.\d+\.\d+\.)(\d+)-\1(\d+)/;
for my $byte ($b_ip .. $e_ip)
On Feb 28, 2:47 pm, rich.j...@gmail.com (steve park) wrote:
> I have a below program and I am not doing it right.
> Currently, only last ip pool is going in since I am putting them w/ key to
> values(so only last one shows up when I print).
Hello Steve,
The reason you only get the last value for
On 28/02/2011 19:56, steve park wrote:
>
> I have a below program and I am not doing it right. Currently, only
> last ip pool is going in since I am putting them w/ key to values(so
> only last one shows up when I print).
>
> How can I aggregate and assign them to server_1 so that when I print
> be
On 2/28/11 Mon Feb 28, 2011 11:47 AM, "steve park"
scribbled:
> I have a below program and I am not doing it right.
> Currently, only last ip pool is going in since I am putting them w/ key to
> values(so only last one shows up when I print).
>
> How can I aggregate and assign them to server_1
On Mon, Feb 28, 2011 at 02:47:30PM -0500, steve park wrote:
Hello,
A couple of things in addition to what Shlomi had already mentioned.
First, you must check your regex. It doesn't really match what you have
mentioned in the __DATA__ section.
Next, doing join('', ...) is just a verbose way of u
calised a variable to its innermost scope?
>
> How can I aggregate and assign them to server_1 so that when I print below
> will show up?
>
> server_1
> 10.1.1.1
> 10.1.1.2
> 10.1.1.3
> 10.1.1.4
> 10.1.1.5
> 192.168.1.1
> 192.168.1.2
Use a hash or an array
I am not sure if I am still in mailing list. so cc'ing myself.
On Mon, Feb 28, 2011 at 2:47 PM, steve park wrote:
>
> I have a below program and I am not doing it right.
> Currently, only last ip pool is going in since I am putting them w/ key to
> values(so only last one shows up when I print).
I have a below program and I am not doing it right.
Currently, only last ip pool is going in since I am putting them w/ key to
values(so only last one shows up when I print).
How can I aggregate and assign them to server_1 so that when I print below
will show up?
server_1
10.1.1.1
10.1.1.2
10.1.1
> "PK" == Parag Kalra writes:
PK> print "$field\n"
what would that supposedly do to help with the question?
and please bottom post. this is a good example. your one line of code
should be BELOW the code it replaces or purports to fix.
thanx,
uri
--
Uri Guttman -- u...@stemsyst
On 2/3/11 Thu Feb 3, 2011 5:05 AM, "Téssio Fechine"
scribbled:
> The program:
> --
> #use strict;
> use warnings;
>
> my $field = shift @ARGV;
> my $regex = '(\w+)\s*' x $field;
>
> while () {
> if (/$regex/) {
> print "$$field\n"; # refers to a match variable
> }
> }
> --
>
> Example Usage:
print "$field\n"
~Parag
2011/2/3 Téssio Fechine
> The program:
> --
> #use strict;
> use warnings;
>
> my $field = shift @ARGV;
> my $regex = '(\w+)\s*' x $field;
>
> while () {
>if (/$regex/) {
>print "$$field\n"; # refers to a match variable
>}
> }
> --
> "TF" == Téssio Fechine writes:
TF> The program:
TF> --
TF> #use strict;
TF> use warnings;
TF> my $field = shift @ARGV;
TF> my $regex = '(\w+)\s*' x $field;
TF> while () {
TF> if (/$regex/) {
TF> print "$$field\n"; # refers to a match variable
TF> }
On 11-02-03 08:05 AM, Téssio Fechine wrote:
The program:
--
#use strict;
use warnings;
my $field = shift @ARGV;
my $regex = '(\w+)\s*' x $field;
while () {
if (/$regex/) {
print "$$field\n";# refers to a match variable
}
}
--
Example Usage:
--
$ echo 'Strang
The program:
--
#use strict;
use warnings;
my $field = shift @ARGV;
my $regex = '(\w+)\s*' x $field;
while () {
if (/$regex/) {
print "$$field\n"; # refers to a match variable
}
}
--
Example Usage:
--
$ echo 'Strange New World!' | ./this_program 3
$ World
--
the final loop values.
> One solution: declare @mytemp within -- rather than outside --
> the loop. This allocates new memory for @mytemp during
> each loop iteration to prevent overwriting.
>
> while(<$myfile>)
>{
>($a, $b $c ) = getparameter();
>my @mytemp = (
On 2010-11-04 10:16, Christian Stalp wrote:
Hello together,
I try to write some arrays into arrays using references.
my ($a, $b, $c, @mytemp, $myref, @my_globael_array)
while(<$myfile>)
{
($a, $b $c ) = getparameter();
@mytemp = ($a, $b, $c);
$myref = \...@mytemp;
push(@my_glob
On Nov 4, 2:16 am, christian1...@gmx.net ("Christian Stalp") wrote:
> Hello together,
> I try to write some arrays into arrays using references.
>
> my ($a, $b, $c, @mytemp, $myref, @my_globael_array)
>
> while(<$myfile>)
> {
> ($a, $b $c ) = getparameter();
> �...@mytemp = ($a, $b, $c);
>
On Thu, Nov 4, 2010 at 4:16 AM, Christian Stalp wrote:
> Hello together,
> I try to write some arrays into arrays using references.
>
> my ($a, $b, $c, @mytemp, $myref, @my_globael_array)
>
> while(<$myfile>)
> {
> ($a, $b $c ) = getparameter();
> @mytemp = ($a, $b, $c);
> $myref = \...@myte
Hi Christian.
On Thursday 04 November 2010 11:16:46 Christian Stalp wrote:
> Hello together,
> I try to write some arrays into arrays using references.
>
> my ($a, $b, $c, @mytemp, $myref, @my_globael_array)
Your code won't compile - you've mis-spelt "global" and you're missing a
trailing semic
Hello together,
I try to write some arrays into arrays using references.
my ($a, $b, $c, @mytemp, $myref, @my_globael_array)
while(<$myfile>)
{
($a, $b $c ) = getparameter();
@mytemp = ($a, $b, $c);
$myref = \...@mytemp;
push(@my_global_array, $myref);
}
But if I dismantle @my_globa
bject: Re: anonymous hash reference
>>>>> "JP" == Jeff Pang writes:
JP> print check_for_exists('name','foo');
JP> sub check_for_exists {
JP>my $key = shift;
JP>my $value = shift;
JP> for my $item (@$foo)
> "JP" == Jeff Pang writes:
JP> print check_for_exists('name','foo');
JP> sub check_for_exists {
JP>my $key = shift;
JP>my $value = shift;
JP> for my $item (@$foo) {
JP> if ($item->{$key} eq $value ) {
JP>return 1;
JP> }
JP> }
于 2010-10-31 21:43, Thorsten Scherf 写道:
Hi,
I have an array with anonymous hash references like the following:
$foo = [ {
name = value,
id = value,
},
{
name = value,
id = value,
}
];
Iterating through the hash references works with:
foreach $item (@$foo) {
do something with $item->name;
}
1 - 100 of 680 matches
Mail list logo