Re: What are the environmental variables used by Perl?

2019-05-30 Thread Jeffrey Walton
On Thu, May 30, 2019 at 10:21 AM John SJ Anderson wrote: > > > Do you know if there is a list of environmental variables anywhere? > > > I think maybe this is what you’re looking for? > https://perldoc.pl/perlrun#ENVIRONMENT > Thanks John. perlrun - I probably would not

Re: What are the environmental variables used by Perl?

2019-05-30 Thread Jeffrey Walton
On Thu, May 30, 2019 at 10:14 AM Andrew Solomon wrote: > > Assuming you're on a Linux box the command 'env' should tell you that. Is > that what you're looking for? No. I'm looking for a list of Perl specific environmental variables. Like the one you offered

Re: What are the environmental variables used by Perl?

2019-05-30 Thread John SJ Anderson
> > Do you know if there is a list of environmental variables anywhere? I think maybe this is what you’re looking for? https://perldoc.pl/perlrun#ENVIRONMENT <https://perldoc.pl/perlrun#ENVIRONMENT>

Re: What are the environmental variables used by Perl?

2019-05-30 Thread Andrew Solomon
ld do the trick: >> >> export PERL5LIB="$PWD:$PERL5LIB" >> > Thanks, that fixed the Perl path problem. > > Do you know if there is a list of environmental variables anywhere? > > Jeff > -- Andrew Solomon Director P: +44 7931 946 062 E: and...@geekuni.com

Re: What are the environmental variables used by Perl?

2019-05-30 Thread Jeffrey Walton
On Thu, May 30, 2019 at 9:19 AM Andrew Solomon wrote: > In that case I think this should do the trick: > > export PERL5LIB="$PWD:$PERL5LIB" > Thanks, that fixed the Perl path problem. Do you know if there is a list of environmental variables anywhere? Jeff

Re: What are the environmental variables used by Perl?

2019-05-30 Thread Andrew Solomon
In that case I think this should do the trick: export PERL5LIB="$PWD:$PERL5LIB" On Thu, May 30, 2019 at 2:14 PM Jeffrey Walton wrote: > On Thu, May 30, 2019 at 9:06 AM Hao Wu wrote: > > > > https://perldoc.perl.org/Env.html > > Thanks Hao. > > Is there

Re: What are the environmental variables used by Perl?

2019-05-30 Thread Jeffrey Walton
On Thu, May 30, 2019 at 9:06 AM Hao Wu wrote: > > https://perldoc.perl.org/Env.html Thanks Hao. Is there a list of the environmental variables used by Perl? I'm not trying to write Perl code. I am trying to setup the environment because Perl can't find some files in a scrat

Re: What are the environmental variables used by Perl?

2019-05-30 Thread Hao Wu
/linux.die.net/man/1/perl (and others). It is > not clear to me which section of the manual covers environmental > variables used by Perl. > > I found this online, but it does not appear that Perl actually honors > PATH: https://docs.perl6.org/programs/03-environment-variables . (I >

Re: What are the environmental variables used by Perl?

2019-05-30 Thread Andrew Solomon
t > know Perl so it is a struggle. I am happy to refer to the manual, and > it is located at https://linux.die.net/man/1/perl (and others). It is > not clear to me which section of the manual covers environmental > variables used by Perl. > > I found this online, but it does not appe

What are the environmental variables used by Perl?

2019-05-30 Thread Jeffrey Walton
Hi Everyone, I need to fix a self test for a C library written in Perl. I don't know Perl so it is a struggle. I am happy to refer to the manual, and it is located at https://linux.die.net/man/1/perl (and others). It is not clear to me which section of the manual covers environmental vari

Re: deprecated idiom to simulate state variables

2017-01-10 Thread Paul Johnson
On Tue, Jan 10, 2017 at 09:04:00AM +0100, Luca Ferrari wrote: > Hi all, > I guess it was in Modern Perl that I saw this deprecated idiom to > simulate state <http://perldoc.perl.org/functions/state.html> > variables: > > sub foo{ >my $initialized_once = 1 if 0; &

deprecated idiom to simulate state variables

2017-01-10 Thread Luca Ferrari
Hi all, I guess it was in Modern Perl that I saw this deprecated idiom to simulate state <http://perldoc.perl.org/functions/state.html> variables: sub foo{ my $initialized_once = 1 if 0; ... } Now, why is that working and initializing the variable the first time? I mean, each time su

Re: Match Variables Not Working in m//

2014-03-19 Thread Robert Wohlfarth
On Wed, Mar 19, 2014 at 1:49 PM, Thomas H. George wrote: > $_ = " H K53deloresg Bills Hank99 > Pellinor"; > if (/\s*(\w+)\s*(\w+)\*(\w+)\s*(\w+)\s*(\w+)\s*(\w+)/i) { > This pattern is missing the "\s" after the second (\w+). The "\*" matches a literal as

Re: Match Variables Not Working in m//

2014-03-19 Thread Shawn H Corey
On Wed, 19 Mar 2014 14:49:32 -0400 "Thomas H. George" wrote: > if (/\s*(\w+)\s*(\w+)\*(\w+)\s*(\w+)\s*(\w+)\s*(\w+)/i) { > $dud1 = $1; > $dud2 = $2; > $w_player = $3; > $n_player = $4; > $e_player = $5; > $s_player = $6; > } How about: ( $dud1, $dud2, $w_play

Re: Match Variables Not Working in m//

2014-03-19 Thread Andy Bach
On Wed, Mar 19, 2014 at 1:49 PM, Thomas H. George wrote: > Here is the code that is not working > The code you sent was missing an 's' in the RE. It also has no print stmt - trying: #!/usr/bin/perl use diagnostics; use strict; #... my $dud1 = "dud1"; my $dud2 = "dud2"; my $w_player = "?"; my $

Match Variables Not Working in m//

2014-03-19 Thread Thomas H. George
program runs to completion with this block of code included. After the program ends diagnostics complains that the program tried to print $dud2 which had not been initiated. The other match variables print with their assigned initiated values. My system is Debian Wheezy with perl 5.14.2-21 i

Re: About variables passed to sub routines

2013-09-24 Thread Andy Bach
On Tue, Sep 24, 2013 at 8:23 AM, Harry Putnam wrote: > The way in use in script below works... quotations around "@_", so the > content is passed rather than the element count. And the ways that > are commented out also work. > Yeah, that's a bit of a fragile idiom - inside dbl quotes, arrays a

Re: About variables passed to sub routines

2013-09-24 Thread Nathan Hilterbrand
See below, please. On 09/24/2013 09:23 AM, Harry Putnam wrote: Somehow I had it my mind that perl would recognize an incoming variable to a sub routine like: sub test($var) As $_ if there was only one element to @_, But I see from testing that, no, not true. These three methods below a

About variables passed to sub routines

2013-09-24 Thread Harry Putnam
Somehow I had it my mind that perl would recognize an incoming variable to a sub routine like: sub test($var) As $_ if there was only one element to @_, But I see from testing that, no, not true. These three methods below all work. Perhaps there are others. if ( -f "@_" ) (my $fname) =

Re: accessing variables in subroutines

2013-06-28 Thread Shlomi Fish
> >>> > >>> The subroutine does not see the lexical $counter variable because it was > >>> declared after its scope. > >> > >> The subroutine is never called before $counter is declared, so it is > >> always available to the subroutine. There shou

Re: accessing variables in subroutines

2013-06-28 Thread lee
ever called before $counter is declared, so it is >> always available to the subroutine. There should be an error only for >> instances when the subroutine is called before $counter is declared. >> >>> For more information, see: >>> >>> * http://www.plov

Re: accessing variables in subroutines

2013-06-27 Thread Dr.Ruud
On 27/06/2013 15:44, Shawn H Corey wrote: On Thu, 27 Jun 2013 15:07:58 +0200 "Dr.Ruud" wrote: On 27/06/2013 12:58, lee wrote: Ok, so perl has a totally broken design with variables :( No, your understanding is broken. Can you come back after you fixed it? That is rude. The r

Re: accessing variables in subroutines

2013-06-27 Thread Andy Bach
On Thu, Jun 27, 2013 at 11:22 AM, Rob Dixon wrote: > Something like this may help you > > use strict; > use warnings; > > do_something({ title => 'TEST', value => 42 }); > > sub do_something { > my ($params) = @_; > print $params->{title}, "\n"; > do_something_el

Re: accessing variables in subroutines

2013-06-27 Thread Rob Dixon
r called before $counter is declared, so it is always available to the subroutine. There should be an error only for instances when the subroutine is called before $counter is declared. For more information, see: * http://www.plover.com/FAQs/Namespaces.html Ok, so perl has a totally broken

Re: accessing variables in subroutines

2013-06-27 Thread Brandon McCaig
$counter = 0; sub test { # This can see the above declaration. It wouldn't be able to # see the one below. print $counter, "\n"; } #my $counter = 0; while($counter < 5) { test(); $counter++; } __END__ The whole point of lexical variables

Re: accessing variables in subroutines

2013-06-27 Thread John SJ Anderson
> That is rude. The reason this list exists is to help people, not to > tell them to go away. No wonder Perl is not a popular language. Agreed. Dr. Ruud, that was uncalled for. You're not obligated to respond to posters, and if that's the best response you have, not responding would be a better ch

Re: accessing variables in subroutines

2013-06-27 Thread Shawn H Corey
On Thu, 27 Jun 2013 15:07:58 +0200 "Dr.Ruud" wrote: > On 27/06/2013 12:58, lee wrote: > > > Ok, so perl has a totally broken design with variables :( > > No, your understanding is broken. Can you come back after you fixed > it? > That is rude. The reason

Re: accessing variables in subroutines

2013-06-27 Thread timothy adigun
tine does not see the lexical $counter variable because it was >> declared after its scope. > > The subroutine is never called before $counter is declared, so it is > always available to the subroutine. There should be an error only for > instances when the subroutine is called befor

Re: accessing variables in subroutines

2013-06-27 Thread Dr.Ruud
On 27/06/2013 12:58, lee wrote: Ok, so perl has a totally broken design with variables :( No, your understanding is broken. Can you come back after you fixed it? -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http

Re: accessing variables in subroutines

2013-06-27 Thread Shawn H Corey
On Thu, 27 Jun 2013 12:58:38 +0200 lee wrote: > Ok, so perl has a totally broken design with variables :( What's the > solution to this problem? The usual technique is to declare the configuration variables at the top, followed by the file-scoped variables. It is convention that the

Re: accessing variables in subroutines

2013-06-27 Thread lee
declared, so it is always available to the subroutine. There should be an error only for instances when the subroutine is called before $counter is declared. > For more information, see: > > * http://www.plover.com/FAQs/Namespaces.html Ok, so perl has a totally broken design with variables :( What

Re: accessing variables in subroutines

2013-06-26 Thread timothy adigun
Hi On 26 Jun 2013 09:49, "lee" wrote: > > Hi, > > the following example doesn't compile: > > > use strict; > use warnings; > > > sub test { > print $counter . "\n"; The variable $counter is not known here > } > > > my $counter = 0; > while($counter < 5) { > test(); > $counter++; > } >

Re: accessing variables in subroutines

2013-06-26 Thread Shlomi Fish
Hi Lee, On Wed, 26 Jun 2013 10:18:44 +0200 lee wrote: > Hi, > > the following example doesn't compile: > > > use strict; > use warnings; > > > sub test { > print $counter . "\n"; > } > > > my $counter = 0; > while($counter < 5) { > test(); > $counter++; > } > > > It says "Gl

Re: accessing variables in subroutines

2013-06-26 Thread bill pemberton
Scope? On Wednesday, June 26, 2013, lee wrote: > Hi, > > the following example doesn't compile: > > > use strict; > use warnings; > > > sub test { > print $counter . "\n"; > } > > > my $counter = 0; > while($counter < 5) { > test(); > $counter++; > } > > > It says "Global symbol "$cou

accessing variables in subroutines

2013-06-26 Thread lee
Hi, the following example doesn't compile: use strict; use warnings; sub test { print $counter . "\n"; } my $counter = 0; while($counter < 5) { test(); $counter++; } It says "Global symbol "$counter" requires explicit package name ...". When I put the subroutine after the 'whil

Re: Variables in $Excel->Workbooks->Open

2013-06-04 Thread Jenda Krynicky
> Dear All, > > I am having an XLSX file in server and my OS in Win7. The first open > statement is working fine in which we have give the actual file name. > > 2nd open function is not working where we have given the file name as > variable. > > Please help in resolving this error. > > > use

Re: Variables in $Excel->Workbooks->Open

2013-05-07 Thread Jim Gibson
On May 7, 2013, at 1:48 AM, Ganesh Babu N wrote: > I tried your method but it showing the same error. Which method? I made two suggestions. It is always helpful to post the exact program that you tried and the exact error message you are getting. As I explained, I do not have a Windows system

Re: Variables in $Excel->Workbooks->Open

2013-05-07 Thread Ganesh Babu N
I tried your method but it showing the same error. Ganesh On Mon, May 6, 2013 at 8:58 PM, Jim Gibson wrote: > > On May 6, 2013, at 6:42 AM, Ganesh Babu N wrote: > > > > > Dear All, > > > > I am having an XLSX file in server and my OS in Win7. The first open > statement is working fine in which

Re: Variables in $Excel->Workbooks->Open

2013-05-06 Thread Rahim Fakir
I make promish when i learn to perl, i'll help the more people has possible. I hope i don't forget!! On Mon, May 6, 2013 at 4:28 PM, Jim Gibson wrote: > > On May 6, 2013, at 6:42 AM, Ganesh Babu N wrote: > > > > > Dear All, > > > > I am having an XLSX file in server and my OS in Win

Re: Variables in $Excel->Workbooks->Open

2013-05-06 Thread Jim Gibson
On May 6, 2013, at 6:42 AM, Ganesh Babu N wrote: > > Dear All, > > I am having an XLSX file in server and my OS in Win7. The first open > statement is working fine in which we have give the actual file name. > > 2nd open function is not working where we have given the file name as > variable

Variables in $Excel->Workbooks->Open

2013-05-06 Thread Ganesh Babu N
Dear All, I am having an XLSX file in server and my OS in Win7. The first open statement is working fine in which we have give the actual file name. 2nd open function is not working where we have given the file name as variable. Please help in resolving this error. use Win32::OLE; use Win32::O

Re: Variables disappearing in code

2012-10-09 Thread Mark Haney
On 10/09/2012 08:20 AM, Mark Haney wrote: So, this is obviously a problem bigger than just this one routine. But bugger me if I know where to go from here. I don't even know what to say now. I have it working. I'm not entirely sure /why/ it works, but it does. Just for fun, I changed th

Re: Variables disappearing in code

2012-10-09 Thread Mark Haney
On 10/05/2012 11:38 AM, Shlomi Fish wrote: Hi Mark, please include a self-contained, minimalised, reproducing example, so we can see what you are doing wrong. Moreover, sometimes minimalising the code to something more self-contained helps you find the problem. Regards, Shlomi Fis

Re: Variables disappearing in code

2012-10-05 Thread Shlomi Fish
Hi Mark, On Fri, 05 Oct 2012 11:25:01 -0400 Mark Haney wrote: > On 10/04/2012 03:23 PM, Shlomi Fish wrote: > > On Thu, 4 Oct 2012 18:11:50 + > > Mark Haney wrote: > > > > This may be a culprit - it seems to be a reference to a scalar that > > is itself an array reference. Usually just doing

Re: Variables disappearing in code

2012-10-04 Thread Uri Guttman
On 10/04/2012 02:11 PM, Mark Haney wrote: I've got a Template Toolkit template that is driving me insane. I've hit the TT list, but it seems more and more like the problem may be more perl related than a templating issue. I've attached the offending files so now let me show what the problem

Re: Variables disappearing in code

2012-10-04 Thread Shlomi Fish
On Thu, 4 Oct 2012 18:11:50 + Mark Haney wrote: > I've got a Template Toolkit template that is driving me insane. I've > hit the TT list, but it seems more and more like the problem may be > more perl related than a templating issue. I've attached the > offending files so now let me show wh

Variables disappearing in code

2012-10-04 Thread Mark Haney
I've got a Template Toolkit template that is driving me insane. I've hit the TT list, but it seems more and more like the problem may be more perl related than a templating issue. I've attached the offending files so now let me show what the problem is. I have two SQL statements that pull fac

Quoting hash keys (was: To quote variables or not)

2012-05-23 Thread sono-io
On May 23, 2012, at 5:35 PM, John W. Krahn wrote: > Your question is not about quoting variables, which is bad, but about quoting > hash keys. On May 23, 2012, at 5:25 PM, Shawn H Corey wrote: > Yes, you can leave the quotes off if the key contains only alphanumerics. > Otherwise

Re: To quote variables or not

2012-05-23 Thread John W. Krahn
sono...@fannullone.us wrote: Subject: To quote variables or not Your question is not about quoting variables, which is bad, but about quoting hash keys. See: perldoc -q quoting A script that I'm refactoring has global variables in two different styles, e.g.: $main::global-&

Re: To quote variables or not

2012-05-23 Thread Shawn H Corey
On 12-05-23 08:13 PM, sono...@fannullone.us wrote: A script that I'm refactoring has global variables in two different styles, e.g.: $main::global->{form}->{'mailprog'} $main::global->{form}->{mailprog} The quote marks don't seem to make a

To quote variables or not

2012-05-23 Thread sono-io
A script that I'm refactoring has global variables in two different styles, e.g.: $main::global->{form}->{'mailprog'} $main::global->{form}->{mailprog} The quote marks don't seem to make a difference, so what would be the advantage of using

Re: Collecting variables from Hash

2012-01-23 Thread Igor Dovgiy
Hi Pradeep, use List::Util qw( sum ); use constant { SUFFICIENT_SUCCESS => 244 } ... my $success = sum( map { /success$/ ? $results_href->{$_} : () } keys %$results_href ); ... return $success == SUFFICIENT_SUCCESS; -- iD 2012/1/22 Pradeep Patra > Hi, > I have a hash reference as follows:

Collecting variables from Hash

2012-01-22 Thread Pradeep Patra
Hi, I have a hash reference as follows: $VAR1 = { A.processor0.error => 0 A.processor0.success => 77 A.processor0.total=> 77 A.processor1.error=> 0 A.processor1.success => 57 A.processor1.total=> 57 A.processor2.error=>

Re: problem with passing variables

2011-12-30 Thread Shlomi Fish
;> SELECT * FROM `events` WHERE `date` BETWEEN ? AND ? > >> /); > >> $sth->execute($begin_time, $end_time); > > > > I can certainly do it this way, however, my ultimate goal is to > > have these variables passed via a web form and since I

Re: problem with passing variables

2011-12-30 Thread Mark Haney
;s another (and in my opinion, usually better) way: using prepared sql statement: my $sth = $dbh->prepare(q/ SELECT * FROM `events` WHERE `date` BETWEEN ? AND ? /); $sth->execute($begin_time, $end_time); I can certainly do it this way, however, my ultimate goal is

Re: problem with passing variables

2011-12-30 Thread Igor Dovgiy
ent: > my $sth = $dbh->prepare(q/ > SELECT * FROM `events` WHERE `date` BETWEEN ? AND ? > /); > $sth->execute($begin_time, $end_time); > > > I can certainly do it this way, however, my ultimate goal is to have these > variables passed via a web form and since I'

Re: problem with passing variables

2011-12-30 Thread Shlomi Fish
Hi Mark, On Fri, 30 Dec 2011 12:39:04 -0500 Mark Haney wrote: > On 12/30/2011 12:30 PM, Igor Dovgiy wrote: > > Hi Mark, > > > > If your variables are strictly internal and by no means might be ever > > tainted (read: user input), what you're doing is mostly o

Re: problem with passing variables

2011-12-30 Thread Mark Haney
On 12/30/2011 12:30 PM, Igor Dovgiy wrote: Hi Mark, If your variables are strictly internal and by no means might be ever tainted (read: user input), what you're doing is mostly ok. But you need to quote the dates passed within query itself, like this: my $sql = qq/SELECT * FROM `e

Re: problem with passing variables

2011-12-30 Thread Shlomi Fish
On Fri, 30 Dec 2011 12:08:50 -0500 Mark Haney wrote: > I'm not sure if this is the right list for this, so bear with me. If it > isn't I'll be glad to post it on the correct one. > > I've got a problem with passing variables to a SQL server inside a CGI

Re: problem with passing variables

2011-12-30 Thread Igor Dovgiy
Hi Mark, If your variables are strictly internal and by no means might be ever tainted (read: user input), what you're doing is mostly ok. But you need to quote the dates passed within query itself, like this: my $sql = qq/SELECT * FROM `events` WHERE `date` BETWEEN '$begin_time'

problem with passing variables

2011-12-30 Thread Mark Haney
I'm not sure if this is the right list for this, so bear with me. If it isn't I'll be glad to post it on the correct one. I've got a problem with passing variables to a SQL server inside a CGI script. My code is like this: my $begin_time = "2011-11-16 11:00:00&quo

Re: getting variables defined from file

2011-11-22 Thread Jim Gibson
On 11/22/11 Tue Nov 22, 2011 10:25 AM, "Noah" scribbled: > HI list, > > Is there an easy way to get variables defined from another file? > specifically I have a series of scalar, array, and hash variables in an > external file. How can I use those variables defin

Re: getting variables defined from file

2011-11-22 Thread Shawn H Corey
On 11-11-22 01:25 PM, Noah wrote: Is there an easy way to get variables defined from another file? specifically I have a series of scalar, array, and hash variables in an external file. How can I use those variables defined and used in the main perl program? See: perldoc -f use perldoc -f

getting variables defined from file

2011-11-22 Thread Noah
HI list, Is there an easy way to get variables defined from another file? specifically I have a series of scalar, array, and hash variables in an external file. How can I use those variables defined and used in the main perl program? Cheers, Noah -- To unsubscribe, e-mail: beginners

Re: How to grab last element of array from split with no temporary variables?

2011-08-18 Thread Brandon McCaig
On Wed, Aug 17, 2011 at 9:58 PM, Randal L. Schwartz wrote: > Golfers do NOT understand the DAMAGE they are doing to Perl's > perception outside the Perl community, and I wish they'd damn well > stop. In my experience, people outside of the Perl community perceive /any/ Perl as obfuscated anyway

Re: How to grab last element of array from split with no temporary variables?

2011-08-17 Thread timothy adigun
> Golfers do NOT understand the DAMAGE they are doing to Perl's > perception outside the Perl community, What is golf? Hi Marc, Perl "golf" is a game where one reduce the number of characters {key "strokes"} used in a perl program, just like how golf players seek to hit balls into series

Re: How to grab last element of array from split with no temporary variables?

2011-08-17 Thread sono-io
On Aug 17, 2011, at 6:58 PM, Randal L. Schwartz wrote: > Golfers do NOT understand the DAMAGE they are doing to Perl's > perception outside the Perl community, What is golf? Marc -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@

Re: How to grab last element of array from split with no temporary variables?

2011-08-17 Thread Randal L. Schwartz
> ""John" == "John W Krahn" writes: >> That's deprecated though, if not already gone. (Looks gone in Perl >> 5.14.) It was a readily-admitted misfeature. John> Unless you're playing golf. :-) I'd argue that Golf itself is a misfeature of Perl. More like a bug. Golfers do NOT understan

Re: How to grab last element of array from split with no temporary variables?

2011-08-14 Thread Peter Scott
On Thu, 11 Aug 2011 23:30:32 -0700, John W. Krahn wrote: > Peter Scott wrote: >> On Thu, 11 Aug 2011 16:17:51 -0700, siegfried wrote: >>> 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 'fore

Re: How to grab last element of array from split with no temporary variables?

2011-08-12 Thread John W. Krahn
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

Re: How to grab last element of array from split with no temporary variables?

2011-08-12 Thread Randal L. Schwartz
> "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:/

Re: How to grab last element of array from split with no temporary variables?

2011-08-12 Thread Rob Dixon
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

Re: How to grab last element of array from split with no temporary variables?

2011-08-12 Thread Rob Dixon
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

Re: How to grab last element of array from split with no temporary variables?

2011-08-12 Thread Brandon McCaig
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

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread John W. Krahn
Peter Scott wrote: On Thu, 11 Aug 2011 16:17:51 -0700, siegfried wrote: This works! Really? I get "find: missing argument to `-exec'" I think your command also renames directories. You want that? Is there a way to do it with less typing? How can I do it without creating a temporary variab

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread Peter Scott
On Thu, 11 Aug 2011 16:17:51 -0700, siegfried wrote: > This works! Really? I get "find: missing argument to `-exec'" I think your command also renames directories. You want that? > Is there a way to do it with less typing? How can I do it > without creating a temporary variable "@p"? Thanks,

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread John W. Krahn
Shawn H Corey wrote: On 11/08/11 07:17 PM, 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" } '

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread Jim Bauer
On Thu, 11 Aug 2011 16:17:51 -0700, wrote: > This works! Is there a way to do it with less typing? How can I do it > without creating a temporary variable "@p"? rename($_, sprintf("./%s.txt", (split '/')[-1])); -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands,

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread Jim Gibson
On 8/11/11 Thu Aug 11, 2011 4:17 PM, "siegfr...@heintze.com" scribbled: > 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[$

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread Shawn H Corey
On 11/08/11 07:17 PM, 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 pe

How to grab last element of array from split with no temporary variables?

2011-08-11 Thread siegfried
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" } ' -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional

Please Stop (Was: environment variables in perl)

2011-07-18 Thread Shawn H Corey
Could someone please remove lel...@claimspages.com from the mailing list so I won't get any more of these annoying messages? Original Message Subject: Re: Re: environment variables in perl Date: Mon, 18 Jul 2011 09:31:05 -0400 From: RightFax E-mail Gateway To: sha

Re: environment variables in perl

2011-07-18 Thread Shawn H Corey
On 11-07-18 09:24 AM, Christian Walde wrote: On Mon, 18 Jul 2011 13:44:39 +0200, Shawn H Corey wrote: In Windows, there is only one environment. That means if a child process changes it, its parent can access the change. In Linux, each process has its own environment. The child process inheri

Re: environment variables in perl

2011-07-18 Thread Christian Walde
On Mon, 18 Jul 2011 13:44:39 +0200, Shawn H Corey wrote: In Windows, there is only one environment. That means if a child process changes it, its parent can access the change. In Linux, each process has its own environment. The child process inherits its parent's at the time of the fork and

Re: environment variables in perl

2011-07-18 Thread Shawn H Corey
On 11-07-18 07:29 AM, Irfan Sayed wrote: if i do in perl like this : print "Environment is : $ENV{'build'}\n"; then it does not pint anything can someone please suggest ?? In Windows, there is only one environment. That means if a child process changes it, its parent can access the change.

environment variables in perl

2011-07-18 Thread Irfan Sayed
hi, i am executing one shell script within perl script. now what i need is , i need to make available all the variables set by that shell script to perl script for example following is the shell script build="abc" export build echo $build now the value of $build i need to acce

environment variables in perl

2011-07-18 Thread Irfan Sayed
hi, i am executing one shell script within perl script. now what i need is , i need to make available all the variables set by that shell script to perl script for example following is the shell script build="abc" export build echo $build now the value of $build i need to acce

Re: problem with naming of variables

2011-03-29 Thread Chas. Owens
On Mon, Mar 28, 2011 at 11:10, Katya Gorodinsky wrote: > Maybe this way: > > @bet1 = (0,0,0,0); > @bet2 = (0,0,0,1); > @bet3 = (0,0,1,0); > >  $random_bet_position = int(rand(3) + 1); > >  $name = 'bet' . $random_bet_position; >  @selected_bet = @{$name}; Symbolic references are incredibly danger

Re: problem with naming of variables

2011-03-28 Thread Brian Fraser
On Mon, Mar 28, 2011 at 12:10 PM, Katya Gorodinsky < katya.gorodin...@ecitele.com> wrote: > $random_bet_position = int(rand(3) + 1); > > $name = 'bet' . $random_bet_position; > @selected_bet = @{$name}; > > No no no. Gosh no. Don't do that. http://perl.plover.com/varvarname.html Brian.

Re: problem with naming of variables

2011-03-28 Thread Chas. Owens
2011/3/28 jj mahoney : > > Hi, How do I name this variable correctly, @{bet$random_bet_position); > With regards to the script below, @selected_bet is suppose to select either > @bet1, @bet2 or @bet3 depending on the chosen number held by > $random_bet_position, so how do I do this? Thanks > > @b

RE: problem with naming of variables

2011-03-28 Thread Katya Gorodinsky
h 28, 2011 4:28 PM To: beginners@perl.org Subject: problem with naming of variables Hi, How do I name this variable correctly, @{bet$random_bet_position); With regards to the script below, @selected_bet is suppose to select either @bet1, @bet2 or @bet3 depending on the chosen numb

Re: problem with naming of variables

2011-03-28 Thread Robert Wohlfarth
2011/3/28 jj mahoney > > Hi, How do I name this variable correctly, @{bet$random_bet_position); > With regards to the script below, @selected_bet is suppose to select either > @bet1, @bet2 or @bet3 depending on the chosen number held by > $random_bet_position, so how do I do this? Thanks > > @bet

problem with naming of variables

2011-03-28 Thread jj mahoney
Hi, How do I name this variable correctly, @{bet$random_bet_position); With regards to the script below, @selected_bet is suppose to select either @bet1, @bet2 or @bet3 depending on the chosen number held by $random_bet_position, so how do I do this? Thanks @bet1 = (0,0,0,0); @bet2 = (0,0,0,1)

Re: excluding undefined variables

2010-12-12 Thread shawn wilson
On Mon, Dec 13, 2010 at 1:05 AM, John W. Krahn wrote: > shawn wilson wrote: >> >> i'm trying to exclude undefined variables for that are to be put into >> a sql database date field, but none of this is working: >> >> sub correctdate {             # make valid

Re: excluding undefined variables

2010-12-12 Thread John W. Krahn
shawn wilson wrote: i'm trying to exclude undefined variables for that are to be put into a sql database date field, but none of this is working: sub correctdate { # make valid sql DATE field my $date = $_[ 0 ]; my ($month, $day, $year) = split / /, $date if defined(

Re: excluding undefined variables

2010-12-12 Thread Brian Fraser
; return $corrected; > Also, if I may, a word about your code: You keep testing some variables for definedness, but don't do anything when they are undefined, so you end up piling on checks. Wouldn't it be simpler to return early? For instance, if $date isn't defined, nothing else

Re: excluding undefined variables

2010-12-12 Thread shawn wilson
On Sun, Dec 12, 2010 at 8:11 PM, shawn wilson wrote: > i'm trying to exclude undefined variables for that are to be put into > a sql database date field, but none of this is working: errr, sorry, my error with the current code is: Global symbol "$corrected" requires exp

excluding undefined variables

2010-12-12 Thread shawn wilson
i'm trying to exclude undefined variables for that are to be put into a sql database date field, but none of this is working: sub correctdate { # make valid sql DATE field my $date = $_[ 0 ]; my ($month, $day, $year) = split / /, $date if defined( $date ); $day =~ s/,/

Re: using variables in a translation

2010-11-30 Thread John
Try: eval "\$test =~ y/$x/$y/;"; Perfect. Thanks, John -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: using variables in a translation

2010-11-30 Thread Shawn H Corey
On 10-11-29 11:51 PM, John wrote: I tried using that, but $test wasn't changed here: $test = "This is a test."; $x = "is"; $y = "si"; eval $test =~ y/$x/$y/; print "$test\n"; Try: eval "\$test =~ y/$x/$y/;"; -- Just my 0.0002 million dollars worth, Shawn P

  1   2   3   4   5   6   7   8   9   10   >