again.
> On Dec 26, 2018, at 9:40 AM, Eldon DeHart wrote:
>
> I can't figure out how to read each line of text back into my program and
> assign it to the variable again.
> Thanks for help in advance.
> Eldon
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.
On 12/26/18 12:40 PM, Eldon DeHart wrote:
I can't figure out how to read each line of text back into my program
and assign it to the variable again.
Thanks for help in advance.
Eldon
please show us the code you have and then we can better help guide you.
also read the FAQ as that is l
I can't figure out how to read each line of text back into my program
and assign it to the variable again.
Thanks for help in advance.
Eldon
wbws.pl
Description: Perl program
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@per
> On Feb 15, 2017, at 11:08 AM, Uri Guttman wrote:
>
> try the even simpler and cleaner use of ||
> my $show_ref = delete $log{'show_ref'} || 'no’;
Uri,
After I had sent in my question, I began wondering if exists was even
necessary, so I experimented with the || solution and it worked
't exist.
and also the big issue with that code is the conditionally modified
assignment with a declaration. the infamous worst example was my $x = 1
if 0;. that would create a static variable in scope. that is very nasty
and supplanted by the state declaration.
but what about this?
m
I’ve read where writing a one-liner like this is frowned upon:
my $show_ref = delete $log{'show_ref'} if (exists $log{'show_ref'});
but what about this?
my $show_ref = exists $log{'show_ref'} ? delete $log{'show_ref'} : 'no’;
They both seem to work without a problem in my tests.
On Sun, Jan 18, 2015 at 9:28 AM, Jim Gibson wrote:
>
>> On Jan 18, 2015, at 9:03 AM, Mike wrote:
>>
>> I was able to find match extraction in the perldoc.
>>
>> Here is a snippet of what I have.
>>
>> my $insult = ( $mech->text =~ m/Insulter\ (.*)\ Taken/ );
>> print "$insult\n";
>>
>> But $insul
Thanks. This worked.
On 1/18/15 12:28 PM, Jim Gibson wrote:
On Jan 18, 2015, at 9:03 AM, Mike wrote:
I was able to find match extraction in the perldoc.
Here is a snippet of what I have.
my $insult = ( $mech->text =~ m/Insulter\ (.*)\ Taken/ );
print "$insult\n";
But $insult is being popula
> On Jan 18, 2015, at 9:03 AM, Mike wrote:
>
> I was able to find match extraction in the perldoc.
>
> Here is a snippet of what I have.
>
> my $insult = ( $mech->text =~ m/Insulter\ (.*)\ Taken/ );
> print "$insult\n";
>
> But $insult is being populated with: 1
>
> It should be populated wi
ong here?
Thanks.
On 1/18/15 11:49 AM, Mike wrote:
Hey everyone, I'm trying to find information on how I can use regular
expressions to populate a variable.
I want to pull text between one set of characters and another set of
characters and use that to populate my variable. Can anyone
On Sun, 18 Jan 2015 11:49:11 -0500
Mike wrote:
> Hey everyone, I'm trying to find information on how I can use regular
> expressions to populate a variable.
>
> I want to pull text between one set of characters and another set of
> characters and use that to populate my
Hey everyone, I'm trying to find information on how I can use regular
expressions to populate a variable.
I want to pull text between one set of characters and another set of
characters and use that to populate my variable. Can anyone point me in
the right direction?
Thanks.
On Wed, 8 Oct 2014 21:36:06 +0200
Hans Ginzel wrote:
> I want to use one global hash variable for options or configuration
> variables like verbose, debug. I don't want to pass them to each
> function or to almost each object.
package main;
our %Opts = (
verbose =>
On Thu, Oct 09, 2014 at 03:50:02AM +1300, Kent Fredric wrote:
First, what are you trying to acheive.
Global variables are rarely a good idea, as is sharing variables
between files.
So the question is, why are you trying to share a variable between
files using globals?
My suggestion
On 9 October 2014 08:36, Hans Ginzel wrote:
> I want to use one global hash variable for options or configuration
> variables
> like verbose, debug. I don't want to pass them to each function
> or to almost each object.
>
Indeed, Jim Gibson explains you can simply declare
The ‘our’ statement associates a simple name with a package global variable in
the current package. Therefore, if you want to make $var in file b.pl mean the
package global variable $var in package a ($a:var), just put ‘our $var;’ after
the ‘package a;’ statement in file b.pl (see below).
On
re 'b.pl';
> package a;
> warn "var=$var";
>
> How to get rid of "no strict qw/vars/;" to not get message "Global symbol
> "$var" requires explicit package name at b.pl", please? There is a package
> specification ("package a;&q
ot get message "Global symbol
"$var" requires explicit package name at b.pl", please? There is a package
specification ("package a;") in the b.pl file.
Generally, I want to add a key to a global class hash variable (%opt)
declared with our in a class module from an
Hi Omega,
On Sat, 1 Feb 2014 11:36:20 -0500
Omega -1911 <1911...@gmail.com> wrote:
> Good advice Shlomi. Thank you again. I should have caught that with fresh
> eyes!
You're welcome! ☺
Regards,
Shlomi Fish
--
-
Shlomi Fis
look like: $sql = "SELECT
> *
> > FROM ".$database_prefix."_bs_services";
> >
> > I have tried a variety of Perl examples including the the code below, but
> > it gives an error.
> >
> > $_ =~ s/bs_/".$database_prefix."_bs/g;
ried a variety of Perl examples including the the code below, but
> it gives an error.
>
> $_ =~ s/bs_/".$database_prefix."_bs/g;
>
It appears that the right hand side of the s/// operation will try to
interpolate «$database_prefix» as a variable. What you need is to escape th
What error?
(Sent from iPhone, so please accept my apologies in advance for any spelling or
grammatical errors.)
> On Feb 1, 2014, at 2:40 AM, Omega -1911 <1911...@gmail.com> wrote:
>
> Hello List: I am trying to go through a folder of php scripts to add a
> database prefix to lines that have
Hello List: I am trying to go through a folder of php scripts to add a
database prefix to lines that have a select statement. Since the database
prefix will differ, I am simply trying to add:
".$database_prefix."
to those lines. For example, instead of the line looking like: $sql =
"SELECT * FROM
while (@array2) {
>> chomp;
>> my $thing = $var->sub3($_); # returns a scalar
>> print $FH "$thing\n";
>> #
>> BOOM!?!?
>> }
>> }
>>
>>
>>
ew stuff in another array,
prints again to the module FH
while (@array2) {
chomp;
my $thing = $var->sub3($_); # returns a scalar
print $FH "$thing\n";
# BOOM!?!?
}
}
the last print always
(@array2) {
> chomp;
> my $thing = $var->sub3($_); # returns a scalar
> print $FH "$thing\n";
> ##### BOOM!?!?
> }
> }
>
>
>
>
> the last print always give me a ". . . . concatenate (.)
e module FH
while (@array2) {
chomp;
my $thing = $var->sub3($_); # returns a scalar
print $FH "$thing\n";
# BOOM!?!?
}
}
the last print always give me a ". . . . concatenate (.) to undefined
Many thanks to Andy Bach, Janek Schleicher, Diab Jerius, and David Precious for
you helpful comments on my post. My problem is solved and, more importantly, I
learned important stuff from all of you!
Rick Triplett
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands,
On Fri, Dec 20, 2013 at 1:46 AM, Janek Schleicher wrote:
> * if you lookup perldoc use,
> you'll see the use Module is equivalent to
> BEGIN { require Module }
> and the BEGIN blocks are run first of all.
>
And so, as it's really a code block, you can, if you want, define vars there
BEGIN {
over my head (I’m a
beginner!), so I was hoping someone could explain a correct way to write this
code if there is one.
use is interpreted at first,
while the normal my $var = 'xyz' declaration is interpreted at runtime.
So when you use use, no variable beside other constants are
On Thu, 19 Dec 2013 12:27:09 -0600, Rick T wrote:
> The following three lines are from a program that works fine for me.
>
> # Choose template file
> use constant TMPL_FILE =>
> "/big/dom/xoldserver/www/templates/open_courses3.html"; my $tmpl
= new
> HTML::Template( filen
id several variants I tried.
What did the error say?
If the above code is verbatim, it's because you missed the trailing
semicolon after the variable definition - i.e.:
my $server = "newserver";
--
David Precious ("bigpresh")
http://www.preshweb.co.uk/ www.pres
The following three lines are from a program that works fine for me.
# Choose template file
use constant TMPL_FILE =>
"/big/dom/xoldserver/www/templates/open_courses3.html";
my $tmpl = new HTML::Template( filename => TMPL_FILE );
I wanted to make the program more portabl
On 09/11/2013 13:33, Unknown User wrote:
I have a variable that has a function in it, e.g.
my $newtime = "time() + 30";
How can i use it in code so that it always returns time() + 30 when it
is called?
Does it *have* to be in a string like this? Where has the string come
On Sat, 9 Nov 2013 16:27:24 +0200
Shlomi Fish wrote:
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my $sub_ref = sub { return time() + 30 };
>
> print "Sub-ref call is: ", scalar( $sub_ref->() ), "\n";
Why not just use a sub?
sub time_delay {
my $delay = shift @_;
return tim
Hi all,
On Sat, 9 Nov 2013 08:45:42 -0500
Shawn H Corey wrote:
> On Sat, 9 Nov 2013 19:03:00 +0530
> Unknown User wrote:
>
> > Hi,
> >
> > I have a variable that has a function in it, eg: my $newtime =
> > "time() + 30";
> > How can i use
On Sat, 9 Nov 2013 19:03:00 +0530
Unknown User wrote:
> Hi,
>
> I have a variable that has a function in it, eg: my $newtime =
> "time() + 30";
> How can i use it in code so that it always returns time() + 30 when
> it is called?
See `perldoc -f eval`
Note that u
Hi,
I have a variable that has a function in it, eg: my $newtime = "time() +
30";
How can i use it in code so that it always returns time() + 30 when it is
called?
o God.
---
On Thursday, 7 November 2013 3:04 PM, Paul Johnson wrote:
On Thu, Nov 07, 2013 at 11:44:27AM +0800, Shaji Kalidasan wrote:
> Dear Perlers,
>
> I am facing problems while setting the $= special variable. Even
> t
On Thu, Nov 07, 2013 at 11:44:27AM +0800, Shaji Kalidasan wrote:
> Dear Perlers,
>
> I am facing problems while setting the $= special variable. Even
> though I set it to 10 it takes the default value which is 60. In line
> number 31, I set the variable to a value of 10. It is n
Dear Perlers,
I am facing problems while setting the $= special variable. Even though I set
it to 10 it takes the default value which is 60. In line number 31, I set the
variable to a value of 10. It is not printing the page number for every 10 lines
Please guide me where I am going wrong
o God.
---
On Wednesday, 23 October 2013 7:50 PM, Jim Gibson wrote:
On Oct 23, 2013, at 12:56 AM, Shaji Kalidasan wrote:
> Dear Perlers
>
> Please throw some light on the $? variable
>
> I am trying to figure out how the internal structure (format) of $?
On Oct 23, 2013, at 12:56 AM, Shaji Kalidasan wrote:
> Dear Perlers
>
> Please throw some light on the $? variable
>
> I am trying to figure out how the internal structure (format) of $? variable.
> Please throw some light on this topic.
The content of $? is explained in th
Dear Perlers
Please throw some light on the $? variable
I am trying to figure out how the internal structure (format) of $? variable.
Please throw some light on this topic.
Any help is highly appreciated.
[code]
system('cat file1.txt');
if($?) {#A Non zero exit code means failure
i
> On Tue, Apr 30, 2013 at 10:07 AM, Piyush Verma <114piy...@gmail.com>
> wrote:
> Hi,I want to use string as a variable name, please explain if there is
any way
> in perl.
> ...
This is a FAQ. See:
http://perldoc.perl.org/perlfaq7.html#How-can-I-use-a-variable-as-a-variabl
On 04/30/2013 12:07 PM, Piyush Verma wrote:
Hi,
I want to use string as a variable name, please explain if there is any way
in perl.
Yes, there is a way. It is almost always a better idea to NOT do it
that way, but to refactor your code to not require using a string as a
variable name
Hi,
I want to use string as a variable name, please explain if there is any way
in perl.
Please have a look on below cases, I want to implement case 2.
e.g.
Case 1: if I am using global varibale without strict module
$var = "this";
$this = "realvalue&quo
On Wed, Dec 26, 2012 at 10:29 AM, Paul Johnson wrote:
> On Wed, Dec 26, 2012 at 04:10:06PM +0100, gator...@yahoo.de wrote:
>> Hi,
>>
>> I would like to store regular expressions and substitution strings in
>> a hash variable. If a given string matches any of
On 2012-12-26 19:29, Paul Johnson wrote:
> This is a situation where string eval is warranted:
>
> eval "\$s =~ s/\$rx/$r/";
... thanks a lot!
Now that I now how it works, I can't believe I couldn't
find the problem!
I had tried string eval too; the real trick that I didn't get
right is that t
On Wed, Dec 26, 2012 at 04:10:06PM +0100, gator...@yahoo.de wrote:
> Hi,
>
> I would like to store regular expressions and substitution strings in
> a hash variable. If a given string matches any of the stored patterns,
> the corresponding substitution should be applied. What or
Hi,
Please, check my comments below:
On Wed, Dec 26, 2012 at 4:10 PM, wrote:
> Hi,
>
> I would like to store regular expressions and substitution strings in
> a hash variable. If a given string matches any of the stored patterns,
> the corresponding substitution should b
Hi,
I would like to store regular expressions and substitution strings in
a hash variable. If a given string matches any of the stored patterns,
the corresponding substitution should be applied. What originally looked
trivial turned out to be quite a challenge, particularly if the
substitution
From: Rob Dixon [rob.di...@gmx.com]
Sent: 09 November 2012 17:17
To: beginners@perl.org
Cc: Nemana, Satya
Subject: Re: variable definition error not caught when using strict and warnings
On 09/11/2012 17:08, Nemana, Satya wrote:
> Hi
>
> I am
On 09/11/2012 17:08, Nemana, Satya wrote:
Hi
I am a little confused with this program
Program:
use strict;
use warnings;
if ($999 == 1056)
{
print ("\nequal");
}
else
{
print ("\nnot equal");
}
What I expect: Perl to throw me an error as $999 variable is no
On Fri, Nov 9, 2012 at 11:08 AM, Nemana, Satya wrote:
>
> if ($999 == 1056)
> {
> print ("\nequal");
> }
> else
> {
> print ("\nnot equal");
> }
>
> What I expect: Perl to throw me an error as $999 variable is not defined,
> but p
On Fri, Nov 9, 2012 at 11:08 AM, Nemana, Satya wrote:
> Program:
> use strict;
> use warnings;
>
> if ($999 == 1056)
> {
> print ("\nequal");
> }
> else
> {
> print ("\nnot equal");
> }
>
> What I expect: Perl to throw me an
Hi
I am a little confused with this program
Program:
use strict;
use warnings;
if ($999 == 1056)
{
print ("\nequal");
}
else
{
print ("\nnot equal");
}
What I expect: Perl to throw me an error as $999 variable is not defined, but
perl executes the code with a war
On Mon, 27 Aug 2012 08:11:12 -0400
Shawn H Corey wrote:
> On Mon, 27 Aug 2012 17:18:10 +0700
> Eko Budiharto wrote:
>
> > my $endDate2 = $time{'dd-mm-', time + 86400 * 14};
> > my $startDate2 = $time{'dd-mm-', time - 86400 * 0};
>
> Where is the hash %time assigned its values?
>
>
F
On Mon, 27 Aug 2012 17:18:10 +0700
Eko Budiharto wrote:
> my $endDate2 = $time{'dd-mm-', time + 86400 * 14};
> my $startDate2 = $time{'dd-mm-', time - 86400 * 0};
Where is the hash %time assigned its values?
--
Just my 0.0002 million dollars worth,
Shawn
Programming is as much
dear members,
I wrote a perl script to write a pdf file. I am stuck in writing a
value from a variable. Please help. thanks in advance.
Here is my script:
#!/usr/local/bin/perl
use CGI qw(:standard);
use strict;
use PDF::API2;
my $endDate2 = $time{'dd-mm-', time + 86400
Thank you Ron and David.
- Original Message -
From: Ron Bergin
To: Rajeev Prasad
Cc: perl list
Sent: Tuesday, August 7, 2012 9:36 PM
Subject: Re: how to set session variable (not session cookie) using perl CGI
--
Rajeev Prasad wrote:
> I am using CGI.pm on my website, bu
--
Rajeev Prasad wrote:
> I am using CGI.pm on my website, but I generate my pages using TT
> (template Toolkit).
>
> I have few questions:
>
> 0. how to have a session variable (not a session cookie)? If I do not want
> to use cookie, do i have to store session data in
On 08/07/12 14:40, Rajeev Prasad wrote:
I am using CGI.pm on my website, but I generate my pages using TT (template
Toolkit).
I have few questions:
0. how to have a session variable (not a session cookie)? If I do not want to
use cookie, do i have to store session data in a temp file on server
I am using CGI.pm on my website, but I generate my pages using TT (template
Toolkit).
I have few questions:
0. how to have a session variable (not a session cookie)? If I do not want to
use cookie, do i have to store session data in a temp file on server and check
it with each page load
$pm->wait_all_children;
However the final value of count is not correct. Is there some race
condition on same variable updation by the processes ?
pm -> run_on_finish (
sub {
my $result = @;
if (def
ing ---
$pm->finish(0, \$result);
}
$pm->wait_all_children;
However the final value of count is not correct. Is there some race
condition on same variable updation by the processes ?
Regards,
Punit
pm -> run_on_finish (
sub {
;
>
>
> $pm->wait_all_children;
>
>
> However the final value of count is not correct. Is there some race
> condition on same variable updation by the processes ?
>
> Regards,
> Punit
>
>
>
> pm -> run_on_finish (
>
>
result);
}
$pm->wait_all_children;
However the final value of count is not correct. Is there some race
condition on same variable updation by the processes ?
Regards,
Punit
pm -> run_on_finish (
sub {
my $result = @;
On 12-06-16 07:36 AM, John W. Krahn wrote:
$ perl -le'
my @strings = (
q/phrase1 "phrase2" phrase3/,
q/"phrase2" phrase3/,
q/phrase1 phrase3 phrase4/,
);
for my $string ( @strings ) {
# change from here
my ( $phrase ) = $string =~ /"([^"]+)"/;
print $phrase if $
Hi Grant,
On Sat, 16 Jun 2012 03:22:58 -0700
Grant wrote:
> Can anyone show me how to save to a variable the contents of a set of
> double-quotes in a string? The string could look like any of these:
>
> phrase1 "phrase2" phrase3
> "phrase2" phrase3
>
Grant wrote:
Can anyone show me how to save to a variable the contents of a set of
double-quotes in a string? The string could look like any of these:
phrase1 "phrase2" phrase3
"phrase2" phrase3
phrase1 phrase3 phrase4
In all of these examples, phrase2 would be saved t
Can anyone show me how to save to a variable the contents of a set of
double-quotes in a string? The string could look like any of these:
phrase1 "phrase2" phrase3
"phrase2" phrase3
phrase1 phrase3 phrase4
In all of these examples, phrase2 would be saved to the variable.
M
$ddd # it always work!
>>
>> but in perl , how can I do like that ?
>>
>> I write a file ( my_env.pl ) like:
>> #!/usr/bin/perl -w
>> my $abc='abc';
>> my $ddd="ddd";
> `my` produces lexical variables which means they are scoped to the file.
gt;
> I write a file ( my_env.pl ) like:
> #!/usr/bin/perl -w
> my $abc='abc';
> my $ddd="ddd";
`my` produces lexical variables which means they are scoped to the file.
These variable will not be accessible outside the file. Tey something like:
use vars qw( $abc $
Hi zapp,
Please my comments below:
2012/4/27 Zapp
> when I use bash, I can write a file ( a.sh ) like :
> abc='abc'
> ddd='aaa'
> ...
> then I can load it in other file:
> source a.sh
> echo $abc $ddd # it always work!
>
> but in perl , how can I do like that ?
>
> I write a file ( my_env.pl )
t;
>>
>> do './my_env.pl' or die '$!\n";
>> print $abc $ddd; # and nothing happen
>>
>> why? anybody knows? Thanks!
>>
>> --
>
>> print $abc $ddd; # and nothing happen
> Are you sure that nothing happends?
> It should have giv
why? anybody knows? Thanks!
>
> --
> print $abc $ddd; # and nothing happen
Are you sure that nothing happends?
It should have given an error like "requires explicit package name " for the
variables which are not defined in your script if you use "use strict".
A
when I use bash, I can write a file ( a.sh ) like :
abc='abc'
ddd='aaa'
...
then I can load it in other file:
source a.sh
echo $abc $ddd # it always work!
but in perl , how can I do like that ?
I write a file ( my_env.pl ) like:
#!/usr/bin/perl -w
my $abc='abc';
my $ddd="ddd";
and in my.pl :
#!/
Hello Harry,
On Fri, 30 Dec 2011 10:03:30 -0800 (PST)
Harry wrote:
> I am confused what this variable does: $_
>
> If someone could give an example or explanation of what this variable $_ does
> in perl, that would be great!
$_ is the default variable, which gets assigned to
I am confused what this variable does: $_
If someone could give an example or explanation of what this variable $_ does
in perl, that would be great!
Thanx.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http
On 12/03/2011 08:12 PM, John W. Krahn wrote:
my @summer = ( qw|
January February March
April May June
July August September
October November December
| )[ 0, 1, 2 );
my @winter = ( qw|
January February March
April May June
July August September
October November December
| )[ 5, 6, 7 );
my @sum
s toes)
Use printf:
printf(
"I am touching my %s and %s\n",
(("heads ", "shoulders ", "knees ", "toes ")[$mone, $mtwo])
);
I tried to create a list variable and then return the output of the
list interpolated but not getting expected re
printf " I am touching my %s and %s", ( "heads ", "shoulders ", "knees
", "toes " )[ $mone, $mtwo ];
I tried to create a list variable
There is no such thing as a "list variable".
and then return the output of the
list interpolated but
);
print (("heads ", "shoulders ", "knees ", "toes ")[$mone, $mtwo]);
print "\n";
which is fine but say I wanted the print result to be: " I am touching
my shoulders and toes" rather than (shoulders toes)
I tried to create a list variable
're using $_[0] both as a string and as a reference. What are you trying
to do?
>
> When the code is executed, I get an error
>
> *Can't use string ("some") as a SCALAR ref while "strict refs" *
>
> This is resolved using - *no strict 'r
gt;
> When the code is executed, I get an error
>
> *Can't use string ("some") as a SCALAR ref while "strict refs" *
>
> This is resolved using - *no strict 'refs*';
>
> Do we need to always use the above while using Perl variable indirection
> - ${$_[0]}
>
> Parag
>
);
sleep 8;
}
When the code is executed, I get an error
*Can't use string ("some") as a SCALAR ref while "strict refs" *
This is resolved using - *no strict 'refs*';
Do we need to always use the above while using Perl variable indirection
- ${$_[0]}
Parag
On 16/10/2011 00:08, JPH wrote:
I am passin a two-dimensional array to a sub and when the sub returns,
the original array has changed. Eventually I want to pass the array into
a recursive sub, so I want to find a way to circumvent this behaviour.
Notice how my global is "@a" and the sub local is
On 16/10/2011 23:18, Rob Dixon wrote:
On 16/10/2011 19:10, JPH wrote:
Every pass I only change a single character, then I run some tests and
so on.
I wonder if it is possible to write your subroutine by using a single
global array and remembering the change so that you can undo it before
the
On 16/10/2011 19:10, JPH wrote:
On 10/16/2011 04:05 AM, Shawn H Corey wrote:
On 11-10-15 07:44 PM, Rob Dixon wrote:
sub try {
my @b;
foreach my $row (@_) {
push @b, [@$row];
}
:
}
Or you could use dclone() from Storable:
use Storable qw( dclone );
sub try {
my @b = @{ dclone( \@_ ) };
..
Thanks! My script seems to work with dclone.
Though the (deep) recursion takes a lot of time ...
What is your opinion, would it pay off (in performance) when I rewrite the
script in such a way that I do not use dclone, but string manipulation routines
instead? So:
- passing a single dimension
You got me there, John. Indeed I do expect it to contain ' ' and not 0 like I
stated.
If you originally assign " " to $a[ 0 ][ 1 ] why would you now expect it to
contain 0?
John
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.
JPH wrote:
Hi all,
Hello,
I am passin a two-dimensional array to a sub and when the sub returns,
the original array has changed. Eventually I want to pass the array into
a recursive sub, so I want to find a way to circumvent this behaviour.
Notice how my global is "@a" and the sub local is "
On 11-10-15 07:44 PM, Rob Dixon wrote:
sub try {
my @b;
foreach my $row (@_) {
push @b, [@$row];
}
:
}
Or you could use dclone() from Storable:
use Storable qw( dclone );
sub try {
my @b = @{ dclone( \@_ ) };
...
}
Storable is a standard modul
On 16/10/2011 00:08, JPH wrote:
Hi all,
I am passin a two-dimensional array to a sub and when the sub returns,
the original array has changed. Eventually I want to pass the array into
a recursive sub, so I want to find a way to circumvent this behaviour.
Notice how my global is "@a" and the sub
On Sun, Oct 16, 2011 at 01:08:19AM +0200, JPH wrote:
> Hi all,
>
> I am passin a two-dimensional array to a sub and when the sub
This is your main problem. Perl doesn't have two-dimensional arrays. What it
does have is arrays of array references which, if you squint, can be used as
two-dimensio
Hi all,
I am passin a two-dimensional array to a sub and when the sub returns, the original array has changed. Eventually I want to pass the array into a recursive sub, so I want to find a way to circumvent
this behaviour. Notice how my global is "@a" and the sub local is "@b"
- Why is this hap
On 11-09-14 11:18 PM, Brandon McCaig wrote:
Personally I agree that it's very sloppy to write without capitals.
I find it sloppy for people whose first language is English not to do
their best. Many readers of this list do not have English as a their
first language and the best way to improv
> "BM" == Brandon McCaig writes:
BM> [1] I personally find it very petty when Uri mentions his work as a
BM> Perl "recruitment agent" (for lack of a better description right now)
BM> and implies that he'll never consider you as a potential candidate
BM> with regards to that because of
they could be. you haven't addressed the scope of the
> number of names out there.
Rob did a very good job of describing this. The amount of detail
required for a variable name is proportional to the scope that the
variable is visible to. A two line subroutine usually does not require
a 10
1 - 100 of 2336 matches
Mail list logo