"Leon" <[EMAIL PROTECTED]> writes:
[...]
> (1)how to make a variable within loops non-lexical as in this eg:-
> while (){
> my $count++; # how to globalised this variable?
$count++; # NO "my", therefore implicitly global.
> };
>
> (2)how to make a variable availab
"Peter Cornelius" <[EMAIL PROTECTED]> writes:
> @val = m/".*?",?/g; # m//g in list context returns all matches
> # list gets all matches of things that begin with a double quote
> # followed by any character zero or more times matching the
> # minimal amount before
- Original Message -
From: "John W. Krahn" <[EMAIL PROTECTED]>
> Leon wrote:
> >
> > - Original Message -
> > From: "Mark Mclogan" <[EMAIL PROTECTED]>
> > > How I can know in that I number of line finds a word in a text file?.
> > > For example, a file "file.txt" contains the foll
Is there a way to open a URL with LWP so that it becomes something like
a filehandle so that I can do a "while ()" on it? This would be
really handy, but I can't sort out how to do it.
The code I am working on originally opened a file, and used a filehandle
to do its thing. Replacing the fil
I am trying to figure out how to insert a gif file in the middle of a word
file(.doc).
I am asking here, becasue I thought maybe someone has come acrss this
before.
I can read the doc file and create it as a different file and word will
read, but if
I try inserting someting into the file, then wo
To get the output you want from the input you listed, you probably don't
want to use split(). Take a look at the m// construct.
use strict; #Always use strict and warnings
use warnings;
my @val; #declare myself an array.
while () { # DATA is a special file handle that reads from t
Hiya Mark,
Something like this should work:
#!/usr/local/bin/perl -w
use strict;
my $file = "file.txt";
open (READ, "<$file") || die "Can\'t open file: $!";
my @list_of_words = ;
close (READ) || die "Can\'t close file: $!";
my $counter = 1;
foreach my $word (@list_of_words){
++$counter;
"Jonathan e. paton" wrote:
>
> Jean-Louis wrote:
> >
> > Now, how can I explode the line. I'd like:
> > $val[0]="a", $val[1]="bcd, efg, h", $val[2]="c" (or
> > equivalent).
>
> C4 or TNT?
Or if you are a DIY kind of guy just mix together some potassium
nitrate, sulfer, and charcoal.
:-)
John
> > I cannot figure out how to use split when the delimiter
> > is the double quote.
>
> @var = split /\"/, $line;
I am of course wrong, you need something more akin to:
@var = split /\".*?\"/, $line;
but as Michael says this isn't the best way to solve the
problem... unless you are looking fo
To: "Jean-Louis" <[EMAIL PROTECTED]>
Subject: Re: help on how to split a string
References: <003701c1909a$e125aab0$74d2fea9@JEANLOUIS>
--text follows this line--
"Jean-Louis" <[EMAIL PROTECTED]> writes:
> I found that $l=readline($filehandle) gives me the content of the current line.
Use these ins
I just wanted to put in a shout for one of my favorite, and unmentioned,
Perl books. "Effective Perl Programming" is by Joseph Hall and Randal
Schwartz. It addresses many of 'am I doing it right' questions. The "Perl
Cook Book' that others have mentioned is also a good reference for this.
I've
> I'm just starting Perl, since... a few hours ago...
You'll be interested in:
www.perl.com
www.perl.org
www.perldoc.com
>
> I have a text files to analyze. Each line looks like :
> "a", "bcd, efg, h", "c"
>
> I found that $l=readline($filehandle) gives me the
> content of the current line.
"Eric S. Harris" <[EMAIL PROTECTED]> writes:
> To my fellow Perl "newbies":
>
> You might want to consider using a more meaningful subject line than something
> like these, all culled from the last month:
> o beginner question
> o Can any one see an error in here I can't?
> o Hello. How can I fi
"jeff" <[EMAIL PROTECTED]> writes:
> I admire your philosophy! I purchased Learning Perl on
> win32 Systems by Schwartz, Olson & Christiansen read and
> worked the exercises and use it daily but now at a point
> where I want more.
Luckey for you, there is more. Someone anticipated your
need.
I have searched this topic from achive but not found yet...
I make a perl daemon script
>From console, my script detach itself using Proc::Daemon::Init (use
Proc::Daemon module I installed from CPAN).
in background, my process looping forever to check some condition saved
in database.
when thi
Oops.. I made some mistake, sorry =)
should be like this :
###
open (FILE, ")
{
@lineNumber = (@lineNumber, $count) if ($_ eq "apple\n") ;
$count++;
}
close (FILE);
###
PS. if you have only 1 apple, then it valued at $lineNumber[0];
h
open (FILE, ") { if ($_ eq "apple\n") { $count++ } }
close (FILE);
you got the result at $count
have a nice day =)
- Original Message -
From: "Mark Mclogan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 29, 2001 5:36 AM
Subject: Question!! number of line
Hi to all!
I'm just starting Perl, since... a few hours ago...
I have a text files to analyze. Each line looks like : "a", "bcd, efg, h", "c"
I found that $l=readline($filehandle) gives me the content of the current line.
Now, how can I explode the line. I'd like:
$val[0]="a", $val[1]="bcd,
here is a small example of two call back functions and their use, please
also see the module's documentation at CPAN.org,
as well as Michael Peppler's site for more in depth information
http://mbay.net/~mpeppler/Sybperl/article.html.
You will likely want much more in depth error management than t
On Fri, Dec 28, 2001 at 12:20:16PM -0500, Maciejewski, Thomas wrote:
> I am having an issue when spawning a child
I understand that this is not uncommon and should not cause undue concern.
> it appears that the environment variable is not being passed to the child
> process here is the code:
Thanks for all the help on my question. I picked the solution to
periodically request a web page on a daily basis (using my browser) to
execute my perl script. Although the "sleep x" worked great I think I will
have problems because our business host server goes down for periodic
maintenance. I
Can anyone tell me how I can access a banner rotation script from within
another
script.
My replicator creates html page in this form:
http://www.yourdomain.com/test/s.cgi?index-1001
I want my rotator script to rotate thew banners at the top of these pages.
I thank you for any help you can give
Agreed Eric.
The more descriptive your subject lines are, the more quickly you are able to get help
and
the more inclined everyone is to help.
Also, as Eric suggested, it will make it easier for newbies to come in later and read
the
emails and find solutions to a similar problem they are having
To my fellow Perl "newbies":
You might want to consider using a more meaningful subject line than something
like these, all culled from the last month:
o beginner question
o Can any one see an error in here I can't?
o Hello. How can I fix this line of code?
o hello!! please help me!!
o Help neede
Question strikes me as a great idea Jeff.
Well I'm still afflicted by the awful leperous backtick habit so this might not
be right but it was fast, and the result sure looks like a duck.
Cheers,
/g
#!perl.exe -w
# Collect perldoc results into a single file.
# Keys in on '^=' to determine if d
Thomas Maciejewski wrote:
>
> --
> This message is intended only for the personal and confidential use of the
>designated recipient(s) named above. If you are not the intended recipient of this
>message you are hereby
Hi,
I just joined this list, and I haven't yet looked at the archives if
this has come up before ...
Now for my question - I am trying to implement a display filter for my
emails using Mutt's $display_filter variable (ie. the output of this
script is displayed in mutt's pager). Now, I want to 's
I admire your philosophy! I purchased Learning Perl on win32 Systems by
Schwartz, Olson
& Christiansen read and worked the exercises and use it daily but now at a
point where I want more. I want to get a hard copy of the perl reference,
but not sure what and how to print it out. I'd like to sta
hi dear team...
hi hamid...
do you work with dbi:dbd ???
thx.
Sincerely yours Nafiseh Saberi
People will forget what you said ...
People will forget what you did...
But people will Never Forget
how you made them feel.
< Any suggestion are welcome to me >
'^' indicates the beginning of a line,
'$' indicates the end
will
s/^$name$/#$name/
do what you want?
- Roger -
- Original Message -
From: "Jose Vicente" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 29, 2001 1:26 AM
Subject: I need your help
> Hi friends.
>
Leon wrote:
>
> - Original Message -
> From: "Mark Mclogan" <[EMAIL PROTECTED]>
> > How I can know in that I number of line finds a word in a text file?.
> > For example, a file "file.txt" contains the following list:
> >
> > Chocolate
> > Cake
> > Cheese
> > Apple
> > orange
> > melon
>
Lance Prais wrote:
>
> Does anyone know how to grab the server time to include it in a file?
my $date = localtime;
Or if you want UTC:
my $date = gmtime;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
32 matches
Mail list logo