> [inherited attributes]
> [get/set accessor methods]
> [regex validation of set]
> [better way?]
I'm not sure about there being a *better* way,
but I'm sure there are a lot of *other* ways.
Various thoughts...
Perl has the concept of tied data items. The basic
operations on those data items, l
> Im using Content-Type TEXT/PLAIN charset=US-ASCII
I think you're missing a colon, and you possibly
have other syntax errors. Check on the net for
the syntax of the Content-type line.
Hi,
Im using Content-Type TEXT/PLAIN charset=US-ASCII
outlook express understands ok but Email express from icq the headers arrives ok but
the body comes:
Unknown mime-type detected!
Message could not be delivered.
> "Maxim" == Maxim Berlin <[EMAIL PROTECTED]> writes:
Maxim> Randal, thank you for your patience and examples, but please do not
Maxim> explain how BEGIN works again. I know that.
No, you don't. I'll stop here, I'm apparently beating my head
against your brick wall.
And judging from the ot
Michael Fowler <[EMAIL PROTECTED]> replies:
> Exporting is usually a bad idea when dealing with classes, it breaks
> encapsulation. You should probably setup a class method for this.
>
> That being said, you can export variables just like you export any other
> data type, with Exporter; perldoc
I would greatly appreciate ANY feedback anyone could
provide. The following page will provide details and a
link to download the tarball.
http://www.redsquirreldesign.com/soapbox
TIA
=
Dave Hoover
"Twice blessed is help unlooked for." --Tolkien
http://www.redsquirreldesign.com/dave
__
> My question pertains to using command line variables in Perl.
> I created a script that uses SQL and runs from an application, and the
only
> parameter is optional. This script works well when the parameter is
> required or not used at all.
> I have altered the SQL script so that it can accept
you only need winzip from www.winzip.com it can uncompress gzip and tar
zipped files no problem !!
i use all the time !!
{--}
Kris G Findlay
{--}
-Original Message-
From: Wright, James C. [mailto:[EMAIL PROTECTED]]
Sent: 28 June 2001 16:03
To: 'David Simcik'; P
I have heard doing it this way will cause grief.. need blocking i/o or
something
along that lines. Also, I head that the flow of the program would _stop_
when reading the data...
are there any other solutions?
Ron
P.S.
kk, I never did get you example code working under Solaris, it works fine
un
Dear Greeg,
>. I intend this e-mail for the more knowledgeable
> programmers who are reading this mailing list.
Well though I don't fall in that category. I have very much felt the need
of same.
We can give it a start and soon we will reach the end also...;-)
Rajeev Rumale
~~~
On Thu, 28 Jun 2001, twelveoaks <[EMAIL PROTECTED]> wrote,
> Peter Scott Wrote:
>
> > my %h;
> > @h{@vars} = ();
> > if (keys %h != @vars) { $youlose = "yes"; }
>
>
> Maybe I'm missing something - won't these *always* match, since @vars has
> been used to create keys %h?
No, depends on the conte
My question pertains to using command line variables in Perl.
I created a script that uses SQL and runs from an application, and the only
parameter is optional. This script works well when the parameter is
required or not used at all.
I have altered the SQL script so that it can accept a variabl
At 09:37 PM 6/28/01 -0400, twelveoaks wrote:
>Peter Scott Wrote:
>
> > my %h;
> > @h{@vars} = ();
> > if (keys %h != @vars) { $youlose = "yes"; }
>
>Maybe I'm missing something - won't these *always* match, since @vars has
>been used to create keys %h?
>
>It seems that way when I test it.
>
>What
Peter Scott Wrote:
> my %h;
> @h{@vars} = ();
> if (keys %h != @vars) { $youlose = "yes"; }
Maybe I'm missing something - won't these *always* match, since @vars has been used to
create keys %h?
It seems that way when I test it.
What I want to detect is whether any two of the values within
At 08:52 PM 6/28/01 -0400, twelveoaks wrote:
>I have a series of variables, say,
> $var0 $var1 $var2 $var3...
>up to lots and lots depending on user input.
>
>They are also available as an array
> @vars = (element1, element2,...)
>
>I want to test to see if any two of their values
First you would need to do a string compare vs numeric compare(ie,
eq vs == ). If they can never enter the same response or value and you
don't care about capitalization, then you could use a hash and either
lower/upper case the input. If key exists and/or is defined, then would have
to r
I found the answer in the previous post "Clear Screen".
On Thu, 28 Jun 2001, sevoski wrote:
>
> Hello,
> I would like to know of a way to refresh a console screen, opposed to just
> augmenting the console text. This would help greatly in making simple
> menus.
>
> --Sebastian Lisic
>
>
>
I have a series of variables, say,
$var0 $var1 $var2 $var3...
up to lots and lots depending on user input.
They are also available as an array
@vars = (element1, element2,...)
I want to test to see if any two of their values are identical. Basically if the user
has made an
Hello
Here is my script, I am missing something. All I am trying to do is to skip
LA and BURLINGTON lines, because they are missing 'MAIN'.
Thanks.
I.S
my %state;
%state = (
CHICAGO => ["MAIN", "BROADWAY", "OAK"],
LA => ["DELTA", "GAMMA"],
BOSTON => ["FIRST", "MAIN"],
BURLINGTON => ["SECOND", "ON
--- Michael Fowler <[EMAIL PROTECTED]> wrote:
> On Thu, Jun 28, 2001 at 02:34:31PM -0700, Paul wrote:
> > > $city = $record[3] ;
> > > for ($i = 0; $i <= $#{ $state{$city}; $i ++ ) {
> >
> > Never use the
> > for( ; ; ) { }
> > construct in Perl without a significant and compelling reason.
On Fri, Jun 29, 2001 at 02:24:56AM +0400, Maxim Berlin wrote:
> Thursday, June 28, 2001, Randal L. Schwartz <[EMAIL PROTECTED]> wrote:
>
> RLS> NO NO. That doesn't work. All of those unshifts are executed REGARDLESS
> RLS> of the $OS type.
> [...]
> Randal, thank you for your patience and examp
On Thu, Jun 28, 2001 at 02:34:31PM -0700, Paul wrote:
> > $city = $record[3] ;
> > for ($i = 0; $i <= $#{ $state{$city}; $i ++ ) {
>
> Never use the
> for( ; ; ) { }
> construct in Perl without a significant and compelling reason.
> foreach is virtually always better for lots of reasons. Try
At 02:24 AM 6/29/01 +0400, Maxim Berlin wrote:
>Thursday, June 28, 2001, Randal L. Schwartz <[EMAIL PROTECTED]> wrote:
>
>RLS> NO NO. That doesn't work. All of those unshifts are executed REGARDLESS
>RLS> of the $OS type.
>[...]
>Randal, thank you for your patience and examples, but please do no
>Could someone please help me translate this. All I can figure out for sure
>are the first 2 lines. For a class assignment we need to: Read the
>documentation on the Data::Dumper module (type 'perldoc Data::Dumper' ).
>Use it to display the contents of your data structure. Thanks in advance.
Hello Randal,
Thursday, June 28, 2001, Randal L. Schwartz <[EMAIL PROTECTED]> wrote:
RLS> NO NO. That doesn't work. All of those unshifts are executed REGARDLESS
RLS> of the $OS type.
[...]
Randal, thank you for your patience and examples, but please do not
explain how BEGIN works again. I kn
Could someone please help me translate this. All I can figure out for
sure are the first 2 lines. For a class assignment we need to: Read
the documentation on the Data::Dumper module (type 'perldoc
Data::Dumper' ). Use it to display the contents of your data
structure. Thanks in advance.
1
[EMAIL PROTECTED] wrote:
>
>
> --- "F.H" <[EMAIL PROTECTED]> wrote:
> > Hi all,
>
> Hi. =o)
>
> > I am trying to skip any line in my input file that doesn't have a
> > city with a street named 'MAIN'. I am matching record[3] in my input
> > file with a $city (array) from a hash (%state) that I
On Jun 28, P lerenard said:
>could I do 16**(0.25)
>can I do that without downloading any module?
Yeah. Just like you did it.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Mo
Hi ,
could I do 16**(0.25)
can I do that without downloading any module?
Thanks,
Pierre
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
From: Tim Musson [mailto:[EMAIL PROTECTED]]
> I like this option the best of the 3, but it is still hard to give to
> a non programing person and not expect them to mess up setting the
> vars...
>
> ie, => is what you separate things with, explaining which ' to
> use (' not `), end each parameter
--- "F.H" <[EMAIL PROTECTED]> wrote:
> Hi all,
Hi. =o)
> I am trying to skip any line in my input file that doesn't have a
> city with a street named 'MAIN'. I am matching record[3] in my input
> file with a $city (array) from a hash (%state) that I got from
> another file. The problem is that
Hi,
Yet another Perl newbie.
Here is what I am trying to do.
I have a script that takes in command line arguments to create a file(s),
i.e. perl --c=country --d=date --i=input file --file=foo.html.
I want a person to be able to fill in a form and the form would send those
seven values as comm
Hello all,
I would like to take a moment to thank everyone who helped me out on
my project. I am obviously new to Perl and am a total hack, but eventually,
I will become proficient. For those that are wondering, my lap dance
program is just a small contest for members of www.ten.com and
I've tried what you are talking about. Specifically I wanted to run a Perl
program from NT Task Scheduler in the background. The mentioned
Win32::Process works (http://www.xav.com/perl/site/lib/Win32/Process.html)
but... if you are trying to do it through Scheduler who'll always have at
least on
Hi all,
I am trying to skip any line in my input file that doesn't have a city with a street
named 'MAIN'. I am matching record[3] in my input file with a $city (array) from a
hash (%state) that I got from another file. The problem is that @city contains more
than one element!
while ($line
Hi all,
I am trying to skip any line in my input file that doesn't have a city with a street
named 'MAIN'. I am matching record[3] in my input file with a $city (array) from a
hash (%state) that I got from another file. The problem is that @city contains more
than one element!
while ($line =
I have this snippet of code that I picked up from "Learning Perl on Win32
Systems" (O'Reilly) that may be helpful. For more info, check the
Win32::Process module. As a Perl rookie myself, I really can't explain it -
I just know it works. ;-)
use Win32::Process;
Win32::Process::Create($Process,
tree [[EMAIL PROTECTED]] quoth:
*>I have a question on administering perl..
*>
*>I recently upgraded perl on the box from 5.6 to 5.6.1 and now i'm seeing
*>alot of these "Subroutine redefined" messages. what is a "subroutine
*>redefined" message??
*>
*>I also had to reinstall alot of CPAN modules
On Jun 28, Katie Elliott said:
>Can you tell me if Date:Calc is the best way for calcuating dates? I
>would like to pass specific dates to analog to do log file analysis on
>the dates.
Katie, I tend to use the standard Time::Local module to do the work. I
don't mind doing some mathematic cal
Bud, what do you expect to be in $line?
you're declaring it, running a while loop, assigning input to $_, changing
something $line (which holds nothing mind you) then printing $line for every
line you get from <>
in short, i *think* you mean:
while(<>){ s/\s+$//; print }
hth
Jos Boumans
-
At 03:27 PM 6/28/01 -0500, you wrote:
>All,
>I wish to remove trailing spaces..
>
>#!/usr/bin/perl -w
>use strict ;
>my $line ;
>while (<>) {
>chomp $_ ;
>$line =~ s/\s+$//; # remove trailing spaces
>print " $line \n";
>}
>
>My output is equal number of blank lines..
>
>Where is my error?
>
>Fr
On Thu, 28 Jun 2001, Frank Newland wrote:
> #!/usr/bin/perl -w
> use strict ;
> my $line ;
> while (<>) {
> chomp $_ ;
> $line =~ s/\s+$//; # remove trailing spaces
> print " $line \n";
> }
No where in your script do you assign a value to line. What you want is
something like:
#!/usr/bin/pe
All,
I wish to remove trailing spaces..
#!/usr/bin/perl -w
use strict ;
my $line ;
while (<>) {
chomp $_ ;
$line =~ s/\s+$//; # remove trailing spaces
print " $line \n";
}
My output is equal number of blank lines..
Where is my error?
Frank
Hi,
Can you tell me if Date:Calc is the best way for calcuating dates? I would like to
pass specific dates to analog to do log file analysis on the dates.
Here are my scripts:
1)Previous Month
#!/usr/bin/perl
use Date::Calc qw( Today Days_in_Month Date_to_Text);
($year,$month) = Today();
I have a question on administering perl..
I recently upgraded perl on the box from 5.6 to 5.6.1 and now i'm seeing
alot of these "Subroutine redefined" messages. what is a "subroutine
redefined" message??
I also had to reinstall alot of CPAN modules.. i'm probably being
boneheaded and there's d
On Thu, Jun 28, 2001 at 09:51:19AM -0400, Ronald J. Yacketta wrote:
> to make a long story short I have a req to-do the following. 1) gather
> continues data from netstat -I hme0 $SLEEPTIME > $netstatTMPFILE & while
> still parsing other information/data etc..
Given David M. Lloyd's suggestion to
On Thu, Jun 28, 2001 at 03:05:17PM -0400, Richard J. Barbalace wrote:
> The 'use base' pragma nicely takes care of the @ISA and %FIELDS
> variables for me, but I also need to have the package global variable
> %Attributes inherited. The 'use vars' and assignment in MyPackage is
> rather verbose,
Hi.
I feel like I'm asking a lot of questions lately, but this list has
been extremely helpful. :)
I'm writing some packages that inherit from a base class, which has
some fields and some global variables that I want inherited. I have
code like:
# La/De/Da/MyBase.pm
package La::De::Da
Thanks a lot and thanks to the guy who mentioned those book, amazon has
my order :)
this code was exactly what i needed...
- Original Message -
From: "Chas Owens" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 28, 2001 7:07 PM
Subject: Re: Fork (not the kind you ea
the code that i sent you should be able to do that.
/kk
On Thu, Jun 28, 2001 at 09:51:19AM -0400, Ronald J. Yacketta wrote:
> Folks,
>
> to make a long story short I have a req to-do the following.
> 1) gather continues data from netstat -I hme0 $SLEEPTIME > $netstatTMPFILE &
> while still parsin
On Thu, Jun 28, 2001 at 05:34:22PM +0100, mark crowe (JIC) wrote:
> > $compare = { split (/:/, $stats)};
> > @records = \$compare;
>
> I think you'd be better off to use:
> @records = split (/:/, $stats)
While this is correct..
> At the moment you are splitting t
to sum it up, i am reading /etc/group, taking the list of users from three
groups (listed in @domains) and then matching each of the users to their
entry in /etc/passwd and printing the line to a file that has the name of
their group.
as it stands, this script only manages to write the passwd in
On Jun 28, Peter Scott said:
>>I want to delete a string but only the last.
>>Example
>>
>>I am the titi last human on titi earth.
>>
>>-> I want to erase the last "titi" nut not the other.
>
>No-one in my mailbox has mentioned a more obvious solution for the regex
>beginner:
>
>s/(.*)titi/$1/
On Thu, Jun 28, 2001 at 09:06:38AM -0700, Jon Riddle wrote:
Be forewarned, what follows is a critique of code you didn't ask about.
> #!/usr/local/bin/perl -w
>
> use CGI;
> use CGI::Carp qw(carpout fatalsToBrowser);
Always:
use strict;
when debugging code.
> $Q = CGI;
This assigns the
This guy had one...
http://www.best.com/~quong/perlin20/
jjr
> -Original Message-
> From: Peter Scott [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 28, 2001 1:15 PM
> To: David Simcik; Perl Cgi; Perl Beginners
> Subject: Re: Perl Boilerplate???
>
>
> At 09:24 AM 6/28/01 -0500, Davi
At 09:24 AM 6/28/01 -0500, David Simcik wrote:
>Hey,
> I, like the rest of you, am always looking for ways to make my
> life more
>convenient. Especially when coding. To this end, I am looking to fashion a
>well-rounded template doc that I can use in Homesite (where I do most of my
>work
At 05:03 PM 6/28/01 +0100, Pierre Smolarek wrote:
>The one thing in perl that gets my head all confused is fork.
>
>Can someone point me in the right direction (be it book, website, or kind
>enough to offer code).
"Network Programming with Perl", by Lincoln Stein (Addison-Wesley, 2001) is
very g
On Thu, 28 Jun 2001, Scott Taylor wrote:
> How can I pass parameters from *nix command line to a Perl script?
> Like $1 in shell scripting.
>
> #!/usr/bin/perl -w
>
> $myfile = $1;
This will:
my $file = $ARGV[0];
@ARGV contains all of the command-line parameters.
-- Brett
>I want to delete a string but only the last.
>Example
>
>I am the titi last human on titi earth.
>
>-> I want to erase the last "titi" nut not the other.
No-one in my mailbox has mentioned a more obvious solution for the regex
beginner:
s/(.*)titi/$1/
"Greed is good." :-)
--
Peter Scott
Pa
A parent can fork as many times as it wants to (for that matter a child
could fork as well). So your code would look like this:
$SIG{CHLD} = "IGNORE"; #works on unix platforms, auto reaps children
foreach $machine (get_machines()) {
$pid = fork;
if ($pid == 0) { #I am a child
At 09:52 AM 6/28/01 -0700, Gregg Williams wrote:
>Hi--I recently posted a message titled "writing readable Perl." In it, I
>said:
snip
>This is a simple example--too simple for some--but it gives you an idea of
>what I'm looking for. Thanks again for your time.
"Readable" is like "obscene" (in
On Thu, Jun 28, 2001 at 11:50:24AM +0200, Stefan Zwijsen wrote:
>
> Hi,
>
> I try to execute the following line on Solaris:
> system ("rsh","btzp17","`/usr/local/bin/perl -e "foreach $line
> (@allfiles) { print $line;}"`") ;
The intent behind the code you have here is very difficult to figure o
On Jun 28, Scott Taylor said:
>How can I pass parameters from *nix command line to a Perl script?
> Like $1 in shell scripting.
You want the @ARGV array. $ARGV[0] is the first argument to your
program. Check the 'perlvar' documentation for more about @ARGV.
--
Jeff "japhy" Pinyan [EMAI
Hello,
How can I pass parameters from *nix command line to a Perl script?
Like $1 in shell scripting.
#!/usr/bin/perl -w
$myfile = $1;
doesn't work.
Thanks.
Scott
NAME
beginners-faq - FAQ for the beginners mailing list
1 - Administriva
1.1 - I'm not subscribed - how do I subscribe?
Send mail to <[EMAIL PROTECTED]>
You can also specify your subscription email address by sending email to
(assuming [EMAIL PROTECTED] is your email address)
> LWP::UserAgent ...
> javascripts on that webpage which I need to execute
You are almost certainly not going to find an otherwise
pure perl user agent that has a full dom understanding
of the web pages it reads, and can invoke a dom-aware
javascript interpreter.
If you *do* find such a solutio
--- Me <[EMAIL PROTECTED]> wrote:
> > I have a file having 100 lines.
> > I want to remove the lines, having a particular string, completely
> > from the file. (notreplacing them with blank lines even)
> >
> > Is there a way in perl for doing this ?
>
> At a shell prompt / command line, enter:
>
that is a very basic hash reference
i have a reference tutorial up, if you want to read more
find it at: www.sharemation.com/~perl/tut
hth
Jos Boumans
- Original Message -
From: "Tim Musson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 28, 2001 6:24 PM
Subject: Re[5]
> I have a file having 100 lines.
> I want to remove the lines, having a particular string, completely
from the
> file. (notreplacing them with blank lines even)
>
> Is there a way in perl for doing this ?
At a shell prompt / command line, enter:
perl -ne '/string/ or print' file
where stri
Hello Randal,
Wednesday, June 27, 2001, Randal L. Schwartz <[EMAIL PROTECTED]> wrote:
HT>> The BEGIN blocks always execute first no matter where you put them.
Maxim>> yes, of course. BEGIN was placed inside just for better readability.
RLS> I actually consider that *less* readable and maintaina
Hi--I recently posted a message titled "writing readable Perl." In it, I
said:
--- snip ---
I am a Perl semi-nubie who has, over the years, been mystified by various
pieces of Perl code I'm interested in in writing some
kind of article for the Perl community advocating a common sense approach
> On Thu, Jun 28, 2001 at 09:49:32AM -0400, Porter, Chris wrote:
> > Still unsure how to approach.
> > Or you could use File::Path::rmtree. I'm surprised no one has given
this
> > answer yet.
And, in case it makes you more comfortable with doing
this in any particular way, I wholeheartedly reco
On Jun 28, Chas Owens said:
>An important note:
>
>Be very careful when reversing the regexp /$* / is not the reverse of
>/ *$/ (/^ */ is).
So how can you reverse a regex safely? Try YAPE::Regex::Reverse... ;)
Actually, I've not released it yet. But it works quite well:
jpinyan@sushi [12:4
Hi Jon
Hey, is this a competition to identify lapdancers or something? If so, don't
forget to post the URL up here when you've got it working ;-) (especially
since we now know all the answers)
Anyway, one thing that might be causing problems is these two lines in your
one_time sub
>
Sorry. Ignore that. It's 5:30 and home time. What can I say.
Use this instead.
$dnvalue =~ /CN=(\w*)/;
$username = $1;
print $username
-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: 28 June 2001 17:31
To: 'Mike Ring'; [EMAIL PROTECTED]
Subject: RE: simple regex q
On Thu, Jun 28, 2001 at 09:49:32AM -0400, Porter, Chris wrote:
> Still unsure how to approach. Very new to perl and I don't want to screw
> this up. Any input from you would be great. Thank you.
>
> -Original Message-
> From: Michael Fowler [mailto:[EMAIL PROTECTED]]
>
> Or you could u
There's no need to match past the CN=, then prepend the CN= back to the
string. Use the following
$dnvalue = "CN=foo,OU=bar,O=pah";
$dnvalue =~ /(CN=[A-Za-z0-9]*)/;
$username = $1;
print $username
This looks for CN= followed by any number of letters (upper or lowercase)
and numbers. If you don'
--- Mike Ring <[EMAIL PROTECTED]> wrote:
> I've learned a bit about regular expressions today. I have a string
> formatted
> like "CN=foo,OU=bar,O=pah" and I need to parse out "foo". I have
> created the
> following code which does work:
>
> $dnvalue =~ m/([^,]*)/;
> $username = $1;
> $username
Hey Jos,
I like this option the best of the 3, but it is still hard to give to
a non programing person and not expect them to mess up setting the
vars...
ie, => is what you separate things with, explaining which ' to
use (' not `), end each parameter line with a ,
Wednesday, June 27, 2001, 6:15
Hello all.
I've learned a bit about regular expressions today. I have a string formatted
like "CN=foo,OU=bar,O=pah" and I need to parse out "foo". I have created the
following code which does work:
$dnvalue =~ m/([^,]*)/;
$username = $1;
$username =~ s/(CN=)//;
print $username
However, I'd lik
Hello everyone,
I am trying to create a simple cgi script that if a user enters the
correct information on a contest form, they are entered into a flat-file DB.
This I have conquered. My next feat is that before I write their personal
information into the DB, I am comparing 3 fields from
The one thing in perl that gets my head all confused is fork.
Can someone point me in the right direction (be it book, website, or kind
enough to offer code).
I need to make a script that has to check 16000 servers in around 6 minutes.
My rough maths works out that 44 checks a second are needed.
On Thu, 28 Jun 2001, F.H wrote:
> I just wonder why the if condition is always true regardless of the value of the
>array AB.
> @AB = [1,2], and $i gets printed even for values not inlcuded in array AB.
>
> foreach $i ( 0 .. $#{ $testsec{'AB'} } ) {
> if ($testsec{'AB'}[$i] = "6543")
Tyler wrote:
> One more quick question. How can I count the values
> in an array
> (@servernames)?
> I want to print my servernames seperately:
[snip]
Tyler,
To get a numeric count of the elements in
@servernames, do this:
$count = @servernames; # count now equals the number
of elements in @s
You've got caught in the old = vs == trap. A single = sign sets the variable
on the left to equal that on the right, while == tests for equality. So in
your case
$testsec{'AB'}[$i] = "6543"
sets $testsec{'AB'}[$i] to "6543", and then returns 'true' (yes, I have
successfully set that var
--- Paul <[EMAIL PROTECTED]> wrote:
>
> --- "F.H" <[EMAIL PROTECTED]> wrote:
> > I just wonder why the if condition is always true regardless of the
> > value of the array AB.
> > if ($testsec{'AB'}[$i] = "6543"){ # always true
>
> Because = is an assignment. =o)
>
> print "fo
--- "F.H" <[EMAIL PROTECTED]> wrote:
> I just wonder why the if condition is always true regardless of the
> value of the array AB.
> if ($testsec{'AB'}[$i] = "6543"){ # always true
Because = is an assignment. =o)
print "foo" if $x = "65343";
will always print, because = retu
Hello,
I would like to know of a way to refresh a console screen, opposed to just
augmenting the console text. This would help greatly in making simple
menus.
--Sebastian Lisic
Hi All,
I just wonder why the if condition is always true regardless of the value of the array
AB.
@AB = [1,2], and $i gets printed even for values not inlcuded in array AB.
foreach $i ( 0 .. $#{ $testsec{'AB'} } ) {
if ($testsec{'AB'}[$i] = "6543"){ # always true
p
$original = "c:\\myfile.txt";
$changed = "c:\\mynewfile.txt";
$searchfor = "john"; # Text identifying line(s) you want removing
open IN, $original or die "Can't open $original: $!";
open OUT, ">$changed" or die "Can't create $changed: $!";
while() {
print OUT unless /$changed/;
}
close
> I have a file having 100 lines.
> I want to remove the lines, having a particular string,
> completely from the
> file. (not replacing them with blank lines even)
>
> Is there a way in perl for doing this ?
most defiantly, tho I am a novice at perl right now.
I have sent this to the beginner
An important note:
Be very careful when reversing the regexp /$* / is not the reverse of
/ *$/ (/^ */ is).
On 28 Jun 2001 11:14:58 -0400, Chas Owens wrote:
> Reverse the string, reverse the pattern, do the substitue, reverse the
> string again.
>
> the string is "I am the titi last human on tit
Reverse the string, reverse the pattern, do the substitue, reverse the
string again.
the string is "I am the titi last human on titi earth."
the pattern is /titi/
so reverse the string (with reverse in a scalar context):
.htrae itit no namuh tsal itit eht ma I
reverse the pattern /itit/
do th
---
I have a file having 100 lines.
I want to remove the lines, having a particular string, completely from the
file. (notreplacing them with blank lines even)
Is there a way in perl for doing this ?
--deepesh
On Thu, 28 Jun 2001, Tyler Longren wrote:
> One more quick question. How can I count the values in an array
> (@servernames)?
> I want to print my servernames seperately:
my $server_count = @servernames;
An array used in a scalar context returns the number of elements in the
array.
or you cou
> I want to delete a string but only the last.
You could search backwards in the string and remove the first occurrence
I do not have the details on doing this, but from reading the master regex
book, it can be done
I am sure others with more perl exp can cough up an example or two..
-Ron
For a great free Unix-like command line interface for Win32, install Cygwin.
It gives you many of the Gnu tools (including gzip) in its original install,
and you can install others (such as Perl). Look at
http://www.xav.com/perl/lib/Pod/perlcygwin.html.
-jim
-Original Message-
From: Davi
Hi
I want to delete a string but only the last.
Example/
I am the titi last human on titi earth.
-> I want to erase the last "titi" nut not the other.
How can I do this
thanks
$length = scalar @servernames;
You could also use
foreach $name(@servernames) {
print "$name\n";
}
John
-Original Message-
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: 28 June 2001 15:39
To: Perl Beginners
Subject: Re: arrays
One more quick question. How can I count
One more quick question. How can I count the values in an array
(@servernames)?
I want to print my servernames seperately:
$i=0;
while ($i <= $num_servers) {
print "$servernames[$i]\n";
}
Something like that (I don't know if that will even work in perl...but it
does in PHP).
Thanks!
Tyler
---
1 - 100 of 132 matches
Mail list logo