Re: Variable Assignment

2011-08-16 Thread Octavian Rasnita
From: "shawn wilson" > On Aug 16, 2011 9:48 PM, "John W. Krahn" wrote: >> >> Joseph L. Casale wrote: >>> >>> What is the correct way to quickly assign the result of a regex against >>> a cmdline arg into a new variable: >>> >>> my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); >> >> >> my ( $var ) = $ARGV[

Re: Variable Assignment

2011-08-16 Thread Jim Gibson
At 11:43 PM -0400 8/16/11, shawn wilson wrote: On Aug 16, 2011 9:48 PM, "John W. Krahn" wrote: Joseph L. Casale wrote: What is the correct way to quickly assign the result of a regex against a cmdline arg into a new variable: my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); my ( $var ) = $AR

Re: Variable Assignment

2011-08-16 Thread shawn wilson
On Aug 16, 2011 9:48 PM, "John W. Krahn" wrote: > > Joseph L. Casale wrote: >> >> What is the correct way to quickly assign the result of a regex against >> a cmdline arg into a new variable: >> >> my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); > > > my ( $var ) = $ARGV[0] =~ /(.*)foo/i; IIRC, that rede

Re: Variable Assignment

2011-08-16 Thread John W. Krahn
Joseph L. Casale wrote: What is the correct way to quickly assign the result of a regex against a cmdline arg into a new variable: my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); my ( $var ) = $ARGV[0] =~ /(.*)foo/i; John -- Any intelligent fool can make things bigger and more complex... It takes a

RE: Variable Assignment

2011-08-16 Thread Joseph L. Casale
>Yes, you can use: > >( my $var = $ARGV[0] ) =~ s/(.*)foo/$1/i; Rob/Octavian, Thanks for the quick help! jlc -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Variable Assignment

2011-08-16 Thread Octavian Rasnita
From: "Joseph L. Casale" What is the correct way to quickly assign the result of a regex against a cmdline arg into a new variable: my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); Obviously that's incorrect but is there a quick way without intermediate assignment? Thanks! jlc Yes, you can use: ( my

Re: Variable Assignment

2011-08-16 Thread Rob Coops
On Tue, Aug 16, 2011 at 8:27 PM, Joseph L. Casale wrote: > What is the correct way to quickly assign the result of a regex against > a cmdline arg into a new variable: > > my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); > > Obviously that's incorrect but is there a quick way without intermediate > assign

Variable Assignment

2011-08-16 Thread Joseph L. Casale
What is the correct way to quickly assign the result of a regex against a cmdline arg into a new variable: my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); Obviously that's incorrect but is there a quick way without intermediate assignment? Thanks! jlc -- To unsubscribe, e-mail: beginners-unsubscr...@pe

variable assignment

2005-11-11 Thread Charles (Chuck) Mattice
Hi All, I'm new to the list and know more php than perl. I can read perl and understand some of it. One problem I seem to be facing is variable assignment and keeping the variables from script to script. In php this is fairly easy by assigning the global to the variable. I'm not s

Re: backticks and variable assignment - thanks

2004-03-23 Thread WC -Sx- Jones
[EMAIL PROTECTED] wrote: this does have to run on multiple servers so that is a concern, but all servers are identical in everyway This is where Yoda sez: "So sure are you?" -- _Sx_ http://youve-reached-the.endoftheinternet.org/ _ perldoc -qa.a | perl -lpe '($_)=m("(.*)")' | grep Martian --

Re: backticks and variable assignment - thanks

2004-03-23 Thread jeffrey_n_Dyke
On Mar 23, 2004, at 9:12 AM, [EMAIL PROTECTED] wrote: >> Hello, >> >> I have some code that is using backticks, executing commands on the >> korn >> shell.(if that matters). Most work as expected and i get the output >> of the >> shell command assigned to the variable left of the argument, like

Re: backticks and variable assignment

2004-03-23 Thread Wiggins d Anconia
> Hello, > > I have some code that is using backticks, executing commands on the korn > shell.(if that matters). Most work as expected and i get the output of the > shell command assigned to the variable left of the argument, like with this > ls command and 'db2 connect' command. > > $is

Re: backticks and variable assignment

2004-03-23 Thread James Edward Gray II
On Mar 23, 2004, at 9:12 AM, [EMAIL PROTECTED] wrote: Hello, I have some code that is using backticks, executing commands on the korn shell.(if that matters). Most work as expected and i get the output of the shell command assigned to the variable left of the argument, like with this ls comma

backticks and variable assignment

2004-03-23 Thread jeffrey_n_Dyke
Hello, I have some code that is using backticks, executing commands on the korn shell.(if that matters). Most work as expected and i get the output of the shell command assigned to the variable left of the argument, like with this ls command and 'db2 connect' command. $is_dump = `ls $root_