Jyoti wrote:
Can someone explain me what these symbols mean in regular expression:
my $trim = sub {local($_)=shift;
$$_ =~ s/^\s*//;
^ means that you want to anchor the pattern at the beginning of the
string in $$_. \s is a character class that matches the whitespace
characters " ", "\
On Thu, 10 Sep 2009 14:01:36 +, Peter Scott wrote:
> Unless it's written by someone whose Perl learning stopped with Perl 4.
Scratch that, I was so focussed on the body of the subroutine I forgot the
context.
> sub trim { $_[0] =~ s/^\s*(.*?)\s*$/$1/ }
my $trim = sub { $_[0] =~ s/^\s*(.*?)\
Peter Scott wrote:
Unless it's written by someone whose Perl learning stopped with Perl 4.
Or someone with a C background and has yet to learn all the nuances or
Perl. :)
--
Just my 0.0002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it
On Thu, 10 Sep 2009 17:43:47 +0530, Ajay Kumar wrote:
> And
> $$_ you can understand like below
>
>
> $name="ajay";
> $class="name"
>
> $$class== ajay
It is unlikely that the original code was called with symbolic references
like you have just explained. More likely it was called with real
r
Thanks All...
Going through documentation as well as short explanation was useful.. I got
it [?]
Cheers!!!
<<330.png>>
2009/9/10 Ajay Kumar :
> And
> $$_ you can understand like below
>
>
> $name="ajay";
> $class="name"
>
> $$class== ajay
Don't use symbolic references. This will not compile under "use
strict;" or "use strict 'refs';". If you need references, use hard
references:
$name = "ajay";
$class = \$name; #
com]
Sent: Thursday, September 10, 2009 5:39 PM
To: Jyoti
Cc: beginners@perl.org
Subject: Re: Help Please
Jyoti wrote:
> Can someone explain me what these symbols mean in regular expression:
>
> my $trim = sub {local($_)=shift;
> $$_ =~ s/^\s*//;
> $$_ =~ s/\s*$//;};
>
&g
Jyoti wrote:
Can someone explain me what these symbols mean in regular expression:
my $trim = sub {local($_)=shift;
$$_ =~ s/^\s*//;
$$_ =~ s/\s*$//;};
Thanks.
Yes, it's all explained in:
http://perldoc.perl.org/5.8.8/perlretut.html
http://perldoc.perl.org/5.8.8/perlre.html
--
Ju
Jeff,
Thanks a lot for your reply. Acutally external APP was passing value to
command prompt so the first option did work.
"Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Jul 22, Perl said:
>
> > what can be the syntex of assigning a variable (my $path) i
On Jul 22, Perl said:
what can be the syntex of assigning a variable (my $path) in perl which is
taking value (for example c:\documents\script.txt) from an expternal APP.
How is your program getting passed this value? On the command-line? If
so, then you would access the value from the @A
[EMAIL PROTECTED] wrote:
>
> Can someone please explain why this
>
> while (1) {
>my $item = ;
>chomp $item;
>last unless $item;
You should use a different test then true or false for $item
last unless length $item;
>$inventory{1c
Madison Daily <[EMAIL PROTECTED]> wrote:
: Can someone please explain why this
:
: while (1) {
:my $item = ;
:chomp $item;
:last unless $item;
:$inventory{1c $item}++;
: }
:
:
: Gets Bare word found where operator expected
: Syntax error line 13
On Thu, 4 Sep 2003 18:46:48 +0200 (CEST), "Paul Johnson" <[EMAIL PROTECTED]> wrote:
>
> K Old said:
> > On Thu, 2003-09-04 at 12:24, [EMAIL PROTECTED] wrote:
> >> Can someone please explain why this
> >>
> >> while (1) {
> >>my $item
K Old said:
> On Thu, 2003-09-04 at 12:24, [EMAIL PROTECTED] wrote:
>> Can someone please explain why this
>>
>> while (1) {
>>my $item = ;
>>chomp $item;
>>last unless $item;
>>$inventory{1c $item}++;
>> }
>
> You probably wanted:
>
> $inventory{'1
On Thu, 2003-09-04 at 12:24, [EMAIL PROTECTED] wrote:
> Can someone please explain why this
>
> while (1) {
>my $item = ;
>chomp $item;
>last unless $item;
>$inventory{1c $item}++;
> }
You probably wanted:
$inventory{'1c'}++;
or
$inventory{$item}+
Hey Peter,
My MUA believes you used
to write the following on Thursday, July 31, 2003 at 10:45:04 AM.
PS> Look for Randal Schwartz's new book on references from O'Reilly.
Ah, cool, will get that soonest!
--
Tim Musson
Flying with The Bat! eMail v1.62q
Windows 2000 5.0.2195 (Service P
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Tim Musson) writes:
>Thanks Peter!,
[snip]
>PS> my $href = $result->as_struct;
>PS> for my $dn (keys %$href) {
>PS> print "cn of $dn is $href->{$dn}{cn}[0]\n";
>PS> }
>
>That is exactly what I was looking for!
>
>PS> (That's taking advantage of
Thanks Peter!,
PS> That's because you missed out the next line, where the value from
PS> (the equivalent of) @$valref{cn} is dereferenced again with
PS> @$attrVal.
PS> I don't know why the dereferencing is done in the example with
PS> @$valref{$attrName}; that's needlessly complicated (single el
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Tim Musson) writes:
>Hey all,
>
> I am using the perl-ldap module (to access MS AD, not that that
> matters to this question though :-).
>
> My problem is I don't understand part of the example code - it all
> works just fine, but using th
use Data::Dumper;
print Dumper($ref);
-Original Message-
From: Tim Musson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 30, 2003 3:40 PM
To: [EMAIL PROTECTED]
Subject: Re: Help please - still not understanding references I think...
Hey bseel,
My MUA believes you used
to
Hey bseel,
My MUA believes you used
to write the following on Wednesday, July 30, 2003 at 9:38:08 AM.
>>> I was thinking (and the documents say) these are references, but I
>>> have had a hard time getting my head around references...
>>>
>>> I have tried adding this
>>> pri
[Snipped]
>> I was thinking (and the documents say) these are references, but I
>> have had a hard time getting my head around references...
>>
>> I have tried adding this
>> print @$valref{cn};
>> but all it prints is
>> ARRAY(0x25d9ec4)
>> and I want it to print the value o
Benjamin Jeeves wrote:
> Hi All
>
> I have a require statement that is run by my main program but I get a error
> "did not return a true value at ./connecttime.pl line 26, line
> 11811302." connecttime.pl is the main program and the script it is executing
> this to do pattern matching on the file
Benjamin Jeeves wrote:
> Hi All
>
> I have a require statement that is run by my main program but I get a
> error "did not return a true value at ./connecttime.pl line 26,
> line 11811302." connecttime.pl is the main program and the
> script it is executing this to do pattern matching on the file
Ack sorry I meant to say the first if statement catches repeating NON Alpha
characters... such as "%%"
-Original Message-
From: Batchelor, Scott [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 1:18 PM
To: 'Jackson, Harry'; [EMAIL PROTECTED]
Subject:
The first if Statement I am checking for Repeating characters such as "aa"
"%%"
In the second if statement I am that there are at least 2 non-alpha
characters in the first 8 letters.
I hope this explains it a bit better...
Again, Thanks in advance.
Scott
Some Questions
> -Original Messa
> -Original Message-
> From: bob ackerman [mailto:[EMAIL PROTECTED]]
>
>
>
> On Friday, May 17, 2002, at 09:40 AM, Batchelor, Scott wrote:
>
> > /([^a-zA-Z])\1/
>
> did you mean to be checking for repeating non-alpha characters?
> if you are testing with repeating alpha characters,
Some Questions
> -Original Message-
> From: Batchelor, Scott [mailto:[EMAIL PROTECTED]]
> Sent: 17 May 2002 17:40
> To: '[EMAIL PROTECTED]'
> Subject: Help please
>
>
> Can anyone tell me why the heck my if statements aren't
> working in this
> subroutine. Everything else seems to wor
On Friday, May 17, 2002, at 09:40 AM, Batchelor, Scott wrote:
> /([^a-zA-Z])\1/
did you mean to be checking for repeating non-alpha characters?
if you are testing with repeating alpha characters, that test won't catch
it.
ed to loop through the data in the array
just like you were in the file.
/\/\ark
-Original Message-
From: Josef E. Galea [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 2:15 PM
To: Ron Powell
Cc: [EMAIL PROTECTED]
Subject: Re: Help Please
RE:
de, feel free to use it. This means that $contents[0] = line 1
$contents[1] = line 2
$contents[2] = line 3
- Original Message -
From: Ron Powell
To: 'Josef E. Galea'
Sent: Tuesday, April 30, 2002 11:09 PM
Subject: RE: Help Please
Does the project you are working on
Ok guys, thank you all for your suggestions. I solved the problem. It consisted of a
bug with the text editor that saved the file as test.txt.txt. Rather lame actually.
Thank you all
Josef
On Sep 17, Rahul Garg said:
>while( ($details_1 = shift(@lines) ) =~ /^$/ )
You have the logic backwards. Change the =~ to a !~ instead.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
*
what you probably want is this:
for(@lines){
last unless $_;
# your stuff;
}
hth,
Jos
@lines is an array which contains blank lines as well as textlines...what i
want to do is to get a line from array thru shift(@lines)
until the array doesnt contain the textline or array has no more
li
Hey, you might want to concider reading up on some tutorials here:
http://www.sharemation.com/~perl/tut
both a regexp as a perldata tutorial are on the site along with a few
more
hth,
Jos Boumans
> > 1. If we are after field 15, how comes you used field 14 in your
> > answer please! **
> 1. If we are after field 15, how comes you used field 14 in your
> answer please! *if ($fields[14] =~
/M/)***
The Nth element of an array is offset N-1.
So $foo[0] is the first element, $foo[1] is the second
and so on. This is a common practice in computing
la
Ur Help is Highly APPRECIATED
> From: Dave Neill [SMTP:[EMAIL PROTECTED]]
>
> If you mean by "field 15" the fifteenth element in your array, try:
>
> > while($line=){
>
> > chomp $line;
>
> > @fields=split "\t",$line;
>
*if ($fields[14] =~ /M/)
{*
From: Govinderjit Dhinsa <[EMAIL PROTECTED]>
> My question was;
> How do I put a condition on the program, as I only want data from the
> input files, which at 'field 15' has a 'M' and some other fileds that I
> need(as marked on example data)!
If you mean by "field 15" the fifteenth elem
> Hello everyone, I finally got my perl program running (below). What I had
> to do was get certain 'data types' (fields) from a input file and out put
> to a new file.
> My question was;
> How do I put a condition on the program, as I only want data from the
> input files, which at 'field 15' h
Tarek,
Your ISP or web hosting provider should have a FAQ or tutorial describing
what CGI options you have available and how to configure them. That would
be the first place I would suggest looking for information specific to your
particular provider and environment.
However, in
--- tarek abo zamel <[EMAIL PROTECTED]> wrote:
> I would like some one to help me, i am so new in Perl:(
> i would like to know step be step, how to make cgi working in my free
> web site i have cgi_bin folder in my free web site, but it is empty,
> what sould i put inside it to make my cgi w
41 matches
Mail list logo