Ryan Moszynski wrote:
hi,
Hello,
i'm using a perl script i found
You should be careful with stuff you find lying around.
to change the names of batches of
files. The program works as is but it's giving me a weird warning.
I'm familiar with $_, but not $_[3]. Can someone explain what $_[
to:[EMAIL PROTECTED]
> > Sent: 18 September 2007 15:12
> > To: beginners@perl.org
> > Subject: perl default variable question
> >
> > hi,
> > i'm using a perl script i found to change the names of batches of files.
> > The program works as is but it'
On 9/18/07, Ryan Moszynski <[EMAIL PROTECTED]> wrote:
> i'm using a perl script i found to change the names of batches of
> files. The program works as is but it's giving me a weird warning.
> I'm familiar with $_, but not $_[3]. Can someone explain what $_[3]
> is, and how i can get this script
:-)
$_ is basically the first variable of @_ which is the array that Perl is
currently working on.
So when your script is complaining about something in $_[3] what it is
saying is that the 4th variable (Perl starts counting at 0) in the @_ array
is making the compiler unhappy.
I hope this helps
hi,
i'm using a perl script i found to change the names of batches of
files. The program works as is but it's giving me a weird warning.
I'm familiar with $_, but not $_[3]. Can someone explain what $_[3]
is, and how i can get this script to stop throwning the warning?
Thanks,
Ryan
i found the
Michael -- As I had earlier posited, it was just out of curiosity and the question was
more in tune with academic curiosity rather than pragmatic correctiveness.
I always used to have "named iterators", but when I was programming without them
today, this question came up to my mind instantaneou
On Mon, Sep 09, 2002 at 02:29:24PM -0700, RTO RTO wrote:
> $_ variable points to list in the outer-loop or
> inner-loop depending upon the scope. I prefer to not
> use aliases. In such a case, when I am in the scope of
> inner loop, can I access the looping variable on the
> outer without using an
Note: forwarded message attached.
__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
--- Begin Message ---
Tim -- Thanks for your rejoinder.
Mostly, I do use 'aliased' variables within nested
loops. However, t
m: RTO RTO [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 09, 2002 2:33 PM
To: [EMAIL PROTECTED]
Subject: $_ variable question
Friends:
I have an outerloop with a list and so do I have an
inner loop with another list.
$_ variable points to list in the outer-loop or
inner-loop depending upon the
Friends:
I have an outerloop with a list and so do I have an
inner loop with another list.
$_ variable points to list in the outer-loop or
inner-loop depending upon the scope. I prefer to not
use aliases. In such a case, when I am in the scope of
inner loop, can I access the looping variable on
Friends:
I have an outerloop with a list and so do I have an
inner loop with another list.
$_ variable points to list in the outer-loop or
inner-loop depending upon the scope. I prefer to not
use aliases. In such a case, when I am in the scope of
inner loop, can I access the looping variable on
7, 2002 11:45 AM
To: [EMAIL PROTECTED]
Subject: Variable question
Hi everyone.
I was wondering how you would determine whether a variable is a number or
not. I want to do an if statement such as
if ($variable is a number) {...
Any help is great. Thanx,
On Wed, Apr 17, 2002 at 02:44:32PM -0400, Helen Dynah wrote:
> I was wondering how you would determine whether a variable is a number or
> not.
Use a regex, see perldoc -q 'is a number' or
http://www.perldoc.com/perl5.6.1/pod/perlfaq4.html, second question in the
"Data: Misc" section.
Michael
Hi everyone.
I was wondering how you would determine whether a variable is a number or not. I want
to do an if statement such as
if ($variable is a number) {...
Any help is great. Thanx,
Helen
-
Find, Connect, Date! Yahoo! Canada Personals
On Wed, 2002-04-10 at 11:10, Randal L. Schwartz wrote:
> > "Bob" == Bob Ackerman <[EMAIL PROTECTED]> writes:
>
> >> At no point do you have an "array" in a scalar context, or a "list"
> >> in a scalar context. Really. You don't. Ever. Get it?
> >>
> >> And why I'm harping on this is that
> "Bob" == Bob Ackerman <[EMAIL PROTECTED]> writes:
>> At no point do you have an "array" in a scalar context, or a "list"
>> in a scalar context. Really. You don't. Ever. Get it?
>>
>> And why I'm harping on this is that I've seen this myth continue to
>> perpetuate, started from some b
On Monday, April 8, 2002, at 12:15 PM, Randal L. Schwartz wrote:
>> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes:
>
> Chas> I emphasize again, that is how I _read_ it. I know that there is no
> Chas> array() and I know why, but that doesn't change how I read things.
> This
> Chas> hac
> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes:
Chas> I emphasize again, that is how I _read_ it. I know that there is no
Chas> array() and I know why, but that doesn't change how I read things. This
Chas> hack forces the far left hand bit to return as a list (by making
Chas> wantarray r
> $count = () = $string =~ /,/g;
> >>
> >> $string =~ /,/g;
> >>
> >> assigns the result in a list context - the anonymous list '()'. by
> >> assigning this to a scalar, $count, we get a value that is
> the size
> >> of the list, which is the number of matches that the regex
> made. that
On Mon, 2002-04-08 at 14:37, Randal L. Schwartz wrote:
> > "Chas" == Chas Owens <[EMAIL PROTECTED]> writes:
>
> >> There is no meaning for "list in a scalar context", so your statement
> >> makes no sense.
>
> Chas> my $some_scalar = () = /\s/g;
>
> Chas> I emphasize again, that is how I _r
> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes:
>> There is no meaning for "list in a scalar context", so your statement
>> makes no sense.
Chas> my $some_scalar = () = /\s/g;
Chas> I emphasize again, that is how I _read_ it. I know that there is no
Chas> array() and I know why, but tha
> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes:
Chas> With the downside that you have an array that you never use. Using ()
Chas> to force list context is one of those strange little quirks that you
Chas> just get used to. These days I read () as the array equivalent of
Chas> scalar().
On Monday, April 8, 2002, at 10:40 AM, Chas Owens wrote:
> On Mon, 2002-04-08 at 12:00, bob ackerman wrote:
>>
>> On Monday, April 8, 2002, at 06:24 AM, David Gray wrote:
>>
I believe it is as simple as:
$count = () = $string =~ /,/g;
>>>
>>> I can't seem to get my brain around
On Mon, 2002-04-08 at 12:00, bob ackerman wrote:
>
> On Monday, April 8, 2002, at 06:24 AM, David Gray wrote:
>
> >> I believe it is as simple as:
> >>
> >> $count = () = $string =~ /,/g;
> >
> > I can't seem to get my brain around what's happening here... would
> > someone be kind enough to ex
On Monday, April 8, 2002, at 06:24 AM, David Gray wrote:
>> I believe it is as simple as:
>>
>> $count = () = $string =~ /,/g;
>
> I can't seem to get my brain around what's happening here... would
> someone be kind enough to explain?
>
> -dave
$string =~ /,/g;
that finds all occurrences of
> I believe it is as simple as:
>
> $count = () = $string =~ /,/g;
I can't seem to get my brain around what's happening here... would
someone be kind enough to explain?
-dave
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Sat, Apr 06, 2002 at 11:32:01PM -0800, John W. Krahn wrote:
> And if you really want to get cute you can put it all on one line:
>
> substr( $ARGV[0], $_, 1 ) eq $ARGV[1] and $cnt++ for 0 .. length(
> $ARGV[0] ) - 1;
> print $cnt;
I count two lines ;-)
Both of these are a little obfuscated,
Aman Cgiperl wrote:
>
> Execute the following on cmd line as follows
> $./cnt.pl ,
> You can replace the comma (,) on the command line to find any other
> character's occurrence in the string
> ___
> #!/usr/bin/perl
>
> for(;$i $str[i] = substr($ARGV[0],$i,1);
>
ECTED]
Subject: Variable question
Hi everybody. I am a new user and my first question to this list is
probably a very simple one. I am trying to count the number of commas
in a variable. The book I am learning from doesn't cover specific
information like that. Thanks for any hel
Thanks everyone for all the help. The suggestions worked great.
Helen
Note: forwarded message attached. Music, Movies, Sports, Games! Yahoo! Canada Entertainment--- Begin Message ---
Hi everybody. I am a new user and my first question to this list is probably a very
simple one. I am tryi
On Fri, 2002-04-05 at 13:46, bob ackerman wrote:
> or, to continue to discussion:
> @s = $string =~ /,/g;
> print scalar @s,"\n";
>
> i don't know how to get count directly assigned to variable. someone?
>
I believe it is as simple as:
$count = () = $string =~ /,/g;
--
Today is Setting Ora
the /g switch of
> m//.
>
> while($string =~ /,/g){
>$num++;
> }
>
> -Original Message-
> From: Tanton Gibbs [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 05, 2002 10:06 AM
> To: Helen Dynah; [EMAIL PROTECTED]
> Subject: Re: Variable question
>
>
>
Just for the sake of argument, you can also do it using the /g switch of
m//.
while($string =~ /,/g){
$num++;
}
-Original Message-
From: Tanton Gibbs [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 10:06 AM
To: Helen Dynah; [EMAIL PROTECTED]
Subject: Re: Variable question
of a
character were in the string.
my $string = "a,b,c";
my $num = $string =~ tr/,//;
print $num;
prints 2.
- Original Message -
From: "Helen Dynah" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 05, 2002 12:52 PM
Subject: Variable quest
Hi everybody. I am a new user and my first question to this list is probably a very
simple one. I am trying to count the number of commas in a variable. The book I am
learning from doesn't cover specific information like that. Thanks for any help.
Helen
--
If you're using Unix (I think even a dos shell can do this sort of thing too), why
couldn't you just do a system call to the shell?
i.e. system(" export MY_Variable=whatever ");
I haven't tried this, but it sure seems like it would work -- provided you're
running and exiting the script as the sa
> I am trying to get [one program to pass some
> info to another]
There's many ways to skin that cat!
(Apologies to my four cats).
I suggest creating a file which contains the directory name.
Hi,
I am atuomating our testing infrastructure using "Testify". The scenario
is:
Testify calls a script that builds and creates the necessary dir. structure
useful to testify. During that process it is suppose to change the
directory name. I am trying to get the perl script return the new directo
--- Hitesh Ray <[EMAIL PROTECTED]> wrote:
> I am required to modify an Environment variable from one value to
> another using perl script. I can access the env. variables in the
perl
> script using ENV. How can i modify so that when I exit my perl script
> -- the env. variable has new value.
Tha
Hitesh Ray ([EMAIL PROTECTED]) wrote:
> >
>
> Hi All,
>
> I am required to modify an Environment variable from one value to another
> using perl script. I can access the env. variables in the perl
> script using ENV. How can i modify so that when I exit my perl script -- the
> env. variable has
: I am required to modify an Environment variable from one value to another
: using perl script. I can access the env. variables in the perl
: script using ENV. How can i modify so that when I exit my perl script -- the
: env. variable has new value.
You can't. Perl scripts are child processes o
>
Hi All,
I am required to modify an Environment variable from one value to another
using perl script. I can access the env. variables in the perl
script using ENV. How can i modify so that when I exit my perl script -- the
env. variable has new value.
Thanks in advance.
Regards,
Hitesh
42 matches
Mail list logo