Ooh. That's embarassing. I didn't pay close enough attention to the OP. Some of the
inside matches contain spaces. My regex should have been:
/^\S+\s+(.+)\s+/
which would match:
* the beginning of the line (^)
* followed by one or more non-whitespace characters (\S+)
* f
On Fri, Jan 23, 2004 at 12:01:13AM -0500, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
> This newbie needs help with a regex. Here's what the data from a text
> file looks like. There's no delimiter and the fields aren't evenly spaced
> apart.
>
> apples San Antonio Fruit
> orang
Try this on for size:
#
use strict;
use warnings;
my @cities = ();
open(INFILE,"myfile.txt") || die "Couldn't open myfile.txt for reading!\n";
while(){
$_ =~ /^\S+\s+(\S+)/;
push @cities,$1;
}
#do something to @cities
#
which basically means t
This newbie needs help with a regex. Here's what the data from a text
file looks like. There's no delimiter and the fields aren't evenly spaced
apart.
apples San Antonio Fruit
oranges Sacramento Fruit
pineapples Honolulu Fruit
lemonsCorona del Rey
On Tue, 2004-01-20 at 16:20, Jan Eden wrote:
>
> I had a similar problem passing a filehandle to a sub and learned that I had to use
> the typeglob instead.
> HTH,Jan
>
> B McKee wrote:
> >Hi All,
> >I'm having trouble understanding what use strict is trying to tell me.
> >If I have run this pro
On Jan 22, 2004, at 5:56 PM, wolf blaum wrote:
[..]
Nevertheless Im happy it seems this is a group were
you can even learn how to explain (and what the group-iquette is
anyway).
[..]
Good point there.
A part of the struggle is always sort out what
the OP is really working with, and where are th
Thank you Dan and Wolf ! With the suggested changes, my foreach loop
script now works as I hoped it would. (My first script did have a typo,
as you pointed out, though my logic was still wrong.) I'm glad to be able
to set aside my study of hashes for another day. I needed to get this
prob
> This very green newbie would like to compare two files, let's say File1
> and File2. I
> want to put the difference from File2 only, into a new file, File3.
I had a very simliar problem about a week ago, which James answerd here:
http://groups.google.com/groups?q=Perl+looping+(a+lot+of)
+file
> My Compliments on a well done piece.
OT:
see, a logical problem I have with newsgroups is that you learn most (at least
I do) by trying to explain things you think you understood to others -
"beginning explainers" however make mistakes -
Thats of course not what you want in a newsgroup, si
On Jan 22, 2004, at 4:52 PM, [EMAIL PROTECTED] wrote:
This very green newbie would like to compare two files, let's say File1
and File2. I
want to put the difference from File2 only, into a new file, File3.
For example:
File1.txt
oranges
apples
bananas
File2.txt
apples
kiwi
bananas
The result I
You should check out the localtime() function in Perl. That way you can
be sure of what you are sending to your program.
perldoc -f localtime
-Original Message-
From: Larry Guest [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 22, 2004 5:07 PM
To: 'Perl Beginners Mailing List'
Subj
One more thing, those loops I was telling you about, just using a pair
of brackets, also keep their scope. It's a good way to clean up with
yourself, i.e.
my $foo = 40;
{
my $foo = 50;
print $foo; # prints 50
# garbage collector called on all declarations before here
}
print $foo; # prints
Lets say file 1 is:
foo
bar
... continues on for 100 lines
And file 2 is:
foo
baz
bar
... continues on exactly the same 100 lines as file 1
Would file 2 be different from file 1 from line 2 and down? Or would it
be different for line 2 and 3?
Also, the keywords:
next; Brings you to the next
I am calling rsync from my perl script. When it runs it creates a dir
where I want the backups to go. I need this dir to be the current
date-time.
I can get the format I want like this.
my $date = `date +%m-%d-%Y_%H-%M-%S`;
Which gives me
01-22-2004_20-04-14
But rsync does not
This very green newbie would like to compare two files, let's say File1
and File2. I
want to put the difference from File2 only, into a new file, File3.
For example:
File1.txt
oranges
apples
bananas
File2.txt
apples
kiwi
bananas
The result I want for File3 is the new entry in File2, which is
On Jan 22, 2004, at 4:32 PM, Mark LoBue wrote:
At 12:12 PM 1/22/2004, John Baker wrote:
[..]
and change it such that the 'unless' conditional operator is
referenced conceptually similar to the following:
sub getFieldFromAllRecords {
my ($self, $directive, $keyword, $matchCondition) = @_;
Rather
At 12:12 PM 1/22/2004, John Baker wrote:
>Greetings.
>
>Is it possible to reference a control operator?
>
>For example, I'd like to take this code:
>
>
> sub getFieldFromAllRecords {
> my ($self, $directive, $keyword, $matchCondition) = @_;
>
>my ($field, $regArr);
>
># anoth
hi,
> I know that each block always starts with and A in the first position of
> the first line and ends with a T in the last position of the last line.
isnt it a T in the first position of the last row of the set?
> I know that the second line starts with a B, and the data in the 5th space
> on
Greetings.
Is it possible to reference a control operator?
For example, I'd like to take this code:
sub getFieldFromAllRecords {
my ($self, $directive, $keyword, $matchCondition) = @_;
my ($field, $regArr);
# another public method within same pkg:
my $allRecs
On Jan 22, 2004, at 3:39 PM, wolf blaum wrote:
[..]
call:
scriptname.pl Universe 42 douglas 'Zappod Beblebrox'
#! /usr/bin/perl
use strict;
use warnings;
print "You called me with ", scalar @ARGV, " Arguments.\n";
if (@ARGV) {
print " Param to script: $_\n" foreach (@ARGV);
}
My Compliments on
> Dan Anderson wrote:
>
> >
> > Very true. But you also need to look at what you're doing.
> A spider
> > that indexes or coallates pages across several sites might need to
> > slurp up a large number of pages -- which even at a few kilobytes a
> > piece would be costly on system resources.
Dan Anderson wrote:
Very true. But you also need to look at what you're doing. A spider
that indexes or coallates pages across several sites might need to slurp
up a large number of pages -- which even at a few kilobytes a piece
would be costly on system resources.
Ironically this is the one tim
On Thu, 2004-01-22 at 18:14, Jeff Collins wrote:
> I'm a perl newby.
> I'm looking on taking a command line argument from
> STDIN and use it for input to a script that upgrades
> software. Any examples would be greatly appreciated.
STDIN is already open when your perl script starts so you can read
On Thu, 2004-01-22 at 18:21, Dan Anderson wrote:
> On Thu, 2004-01-22 at 17:59, James Edward Gray II wrote:
> > On Jan 22, 2004, at 4:12 PM, Tim Johnson wrote:
> >
> > > Here's another argument against slurping: When you slurp a file all at
> > > once, even if your program isn't using up much of
> I'm a perl newby.
me too:-) Right list, I assume.
> I'm looking on taking a command line argument from
> STDIN and use it for input to a script that upgrades
> software. Any examples would be greatly appreciated.
@ARGV holds your command line arguments.
call:
scriptname.pl Universe 42 dougl
On Thu, 2004-01-22 at 17:59, James Edward Gray II wrote:
> On Jan 22, 2004, at 4:12 PM, Tim Johnson wrote:
>
> > Here's another argument against slurping: When you slurp a file all at
> > once, even if your program isn't using up much of the CPU, on many
> > machines it will slow down performance
I'm a perl newby.
I'm looking on taking a command line argument from
STDIN and use it for input to a script that upgrades
software. Any examples would be greatly appreciated.
Thanks
=
Jeffrey T. Collins
[EMAIL PROTECTED]
__
Do you Yahoo!?
Yahoo! SiteBuilder -
On Jan 22, 2004, at 4:12 PM, Tim Johnson wrote:
Here's another argument against slurping: When you slurp a file all at
once, even if your program isn't using up much of the CPU, on many
machines it will slow down performance considerably if you slurp a
large
file (large, of course, is still some
> Here's another argument against slurping: When you slurp a
> file all at once, even if your program isn't using up much of
> the CPU, on many machines it will slow down performance
> considerably if you slurp a large file (large, of course, is
> still sometimes relative). If that is the onl
> > Good comparison, I never see advice to use no warnigns and
> no strict
> > though :)
>
> I've actually seen it a few times in code, but it's usually surrounded
> by:
>
> ##
> ##
> #WARNING!!
> ##
> # Warnings / Strict
I advise people to use "no warnings qw(uninitialized)" from time to
time, and it usually sparks a backlash of "Don't do that!" emails, but
no one has been able to actually give me a good reason why not. I think
it's a similar situation. 90% of the time, you can do it with no
problems, but most
On Thu, 2004-01-22 at 16:49, Dan Muey wrote:
> > > But I see a lot of "don't slurp that" and I was hoping for more
> > > clear reasons/situatuions to or not to slurp so people
> > positn code can have a better idea why a perosn said:
> > > "do(n't) slurp your file here"
> > >
> > > Basically we n
> > But I see a lot of "don't slurp that" and I was hoping for more
> > clear reasons/situatuions to or not to slurp so people
> positn code can have a better idea why a perosn said:
> > "do(n't) slurp your file here"
> >
> > Basically we need to expalin why more:
> >
> > - Don't slurp this beca
On Thu, 2004-01-22 at 16:32, Dan Muey wrote:
> > On Thu, 2004-01-22 at 16:16, Dan Muey wrote:
> > > > On Thu, 2004-01-22 at 13:18, Dan Muey wrote:
> > > > > There are always comments like "you can slurp the file
> > as long as
> > > > > it's not too big" or "becareful not to slurp a really
> > b
> On Thu, 2004-01-22 at 16:16, Dan Muey wrote:
> > > On Thu, 2004-01-22 at 13:18, Dan Muey wrote:
> > > > There are always comments like "you can slurp the file
> as long as
> > > > it's not too big" or "becareful not to slurp a really
> big file or
> > > > you'll be in trouble".
> > >
> > > I
On Thu, 2004-01-22 at 16:16, Dan Muey wrote:
> > On Thu, 2004-01-22 at 13:18, Dan Muey wrote:
> > > There are always comments like "you can slurp the file as
> > > long as it's not too big" or "becareful not to slurp a
> > > really big file or you'll be in trouble".
> >
> > I'd like to add that s
> On Thu, 2004-01-22 at 13:18, Dan Muey wrote:
> > There are always comments like "you can slurp the file as
> > long as it's not too big" or "becareful not to slurp a
> > really big file or you'll be in trouble".
>
> I'd like to add that some of it depends on swap space. I've
> slurped well pa
You could probably use something like Date::Manip or some of the other
routines, but believe this would add a lot of overhead. Here is a small script which
does the basics(you should be able to pull out what would constitute a sub). I just
wanted to show you with a little code you could
I had a very urgent query on the telnet module. I tried finding the
information on the net but came up blank on the same. I am a very recent
freebie and I would really appreciate it if you can help me out here. This
might be a very simple problem, pardon my ignorance but u will really save
me a l
I noticed in the POD for LWP::UserAgent that the post method doesn't
have an option to add headers. Are headers (like UserAgent:) not needed
for POSTing? Or am I missing how to do it?
Thanks in advance,
Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
Check out Time::Local. It makes it easy to break down a formatted date
field and put it into Perl time format.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 22, 2004 11:28 AM
To: [EMAIL PROTECTED]
Subject: Covert Date to week number
Is th
I'm a recent convert. The box higlighting for brackets is great. I
wish the indenting was a little better, but with ready access to
perltidy I can rectify that easy enough.
-Original Message-
From: Luinrandir Hernsen [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 22, 2004 11:43 AM
>
> Is their a way in PERL to covert a date to a week number
>
Sure , why not? You'd need to know the date format to start of course.
I don't mess with dates personally a lot so I'd say have
a look on search.cpan.org for a module to do that.
Also perldoc may be able to help you.
Sorry to be
On Thu, 2004-01-22 at 14:13, JoÃo Figueira wrote:
> Well, I'm a newbie. Just got started in Perl and was stunned by its power.
> The thing is i'm running the scripts in WinXP. Can you tell how to use CGI
> scripts in XP, because if ai try to set a CGI script as ACTION in a forme it
> just gets read
I use OptiPerl from www.xakra.com
Any one else use this?
L Hernsen
- Original Message -
From: "McMahon, Chris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, January 22, 2004 2:32 PM
Subject: RE: Program to write code
>
> I like jEdit: www.jedit.org .
On Thu, 2004-01-22 at 13:18, Dan Muey wrote:
> There are always comments like "you can slurp the file as
> long as it's not too big" or "becareful not to slurp a
> really big file or you'll be in trouble".
I'd like to add that some of it depends on swap space. I've slurped
well past physical me
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 22, 2004 11:28 AM
> To: [EMAIL PROTECTED]
> Subject: Covert Date to week number
>
>
> Is their a way in PERL to covert a date to a week number
>
>
> Cheers
>
> Neill
Date::Calc has w
I like jEdit: www.jedit.org . It runs anywhere Java runs, is
lightweight, knows syntax for most major programming languages (including
Perl) out of the box, and even gets plugins written for it from weirdos like
Tandem people.
I got turned on to jEdit because a vendor I was wor
> Well, I'm a newbie. Just got started in Perl and was stunned
> by its power.
>
> The thing is i'm running the scripts in WinXP. Can you tell
> how to use CGI scripts in XP, because if ai try to set a CGI
> script as ACTION in a forme it just gets read and doesn't execute.
I'm assuming you ar
Is their a way in PERL to covert a date to a week number
Cheers
Neill
IMPORTANT NOTICE This email (including any attachments) is meant only for the
intended recipient. It may also contain confidential and privileged information. If
you are not the intended recipient
[EMAIL PROTECTED] wrote:
Well, I'm a newbie. Just got started in Perl and was stunned by its power.
The thing is i'm running the scripts in WinXP. Can you tell how to use CGI
scripts in XP, because if ai try to set a CGI script as ACTION in a forme it
just gets read and doesn't execute.
I've hear
> On Jan 22, 2004, at 12:18 PM, Dan Muey wrote:
>
> > There are always comments like "you can slurp the file as
> long as it's
> > not too big" or "becareful not to slurp a really big file
> or you'll be
> > in trouble".
> >
> > So what I'd like to survey is what would be what the safest
> ma
Well, I'm a newbie. Just got started in Perl and was stunned by its power.
The thing is i'm running the scripts in WinXP. Can you tell how to use CGI
scripts in XP, because if ai try to set a CGI script as ACTION in a forme it
just gets read and doesn't execute.
I've heard about the bat wrapping, b
I am trying to make sense of a comma delimited log file in which multiple
lines make up 1 record. Here is an example:
A,W29073,Thu Apr 05 15:25:08 2001
B,W29073,Scott,S,[EMAIL PROTECTED],249 Tah Ave,,Sth San Francisco,CA,~US,5-
P,W29073,
X,W29073,Company Name,A,Department Name,San Francis
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (B McKee) writes:
>On Tuesday, January 20, 2004, at 10:34 AM, B McKee wrote:
>
>> Hi All,
>> I'm having trouble understanding what use strict is trying to tell me.
>> If I have run this program
>...snipped
>> open(MESSAGE, "$datafile") or die "Can
On Jan 22, 2004, at 12:18 PM, Dan Muey wrote:
There are always comments like "you can slurp the file as
long as it's not too big" or "becareful not to slurp a
really big file or you'll be in trouble".
So what I'd like to survey is what would be what the safest
max size of a file that one should ev
There are always comments like "you can slurp the file as
long as it's not too big" or "becareful not to slurp a
really big file or you'll be in trouble".
So what I'd like to survey is what would be what the safest
max size of a file that one should ever slurp and why?
(IE if you have
> On Jan 20, 2004, at 9:19 AM, Dan Muey wrote:
>
> > Oops left out a sentence
>
> sorry for the delay.
>
> >> p0: yes, one can use an import() from a package
> >> to make something like the scam of 'require in line'
> >
> > Why is it a scam if that's what I want to do for myself?
>
> I pres
> "Chris" == Chris McMahon <[EMAIL PROTECTED]> writes:
Chris> use warnings;
Chris> use strict;
Chris> use File::Find;
Chris> open (OUT, ">out.txt");
Chris> my $folder = "d:/Directory";
Chris> find (\&wanted, $folder);
Chris> sub wanted {
Chris> print OUT "$File::Find::dir/";
Chris> p
Igor Ryaboy wrote:
> Hi,
> Thanks for your help, 1 more question related to your advice
> Ok, How can I kill exec after it was started in different thread?
> Igor
>
when you fork, you have the pid of the child process. when you exec, the
program in exec will replaced the child process but the p
Thanks! That worked well. I ultimately found the documentation
about how glob doesn't like spaces, but I still struggle with Windows
conventions, so you saved me much effort.
As a side note (which I hope justifies top-posting), I ended up
needing File::Find instead of a regular
Ned,
Here's a great script I use that is written in Perl. Might be a good
starting point or might save you a ton of work.
http://freshmeat.net/redir/ibackup/44196/url_homepage/ibackup
HTH,
Kevin
On Thu, 2004-01-22 at 12:18, Ned Cunningham wrote:
> Hi,
>
> I have a script that runs and zips a
On Jan 22, 2004, at 9:13 AM, Dan Anderson wrote:
Is it possible to call the constructor that a function inherits from
its
parent? I tried calling SUPER:: and SUPER-> in a constructor and got
errors. Am i correct in assuming that if I rewrite the constructor
that
a copy of the parent object w
On Jan 22, 2004, at 11:13 AM, Dan Anderson wrote:
Is it possible to call the constructor that a function inherits from
its
parent?
Yes.
I tried calling SUPER:: and SUPER-> in a constructor and got
errors.
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
# .
Oohhh this is how its related to perl, sorry the new subject line threw me.
> I am in dire need of a script that will upload everything
> from one server to another one that I can cron. Right now I
> have to do it by hand and with more and more updates being
> done to the site, I need a way to
> Is it possible to call the constructor that a function
> inherits from its parent? I tried calling SUPER:: and
> SUPER-> in a constructor and got errors. Am i correct in
> assuming that if I rewrite the constructor that a copy of the
> parent object won't be available?
>
Perhaps some exam
Hi,
I have a script that runs and zips a file, then copies it to another directory on
another system.
It also goes through and renames each file so that it keeps 14 files. The script I am
using is just using system renames and I would like to truly do this in Perl.
So I have started new.
Here
Is it possible to call the constructor that a function inherits from its
parent? I tried calling SUPER:: and SUPER-> in a constructor and got
errors. Am i correct in assuming that if I rewrite the constructor that
a copy of the parent object won't be available?
Thanks in advance,
Dan
--
To u
> I am transferring the data from a Redhat 9 machine to an IIS
There's your first mistake, moving *from* Redhat *to* IIS :)
> server run by my ISP. I just tried running rsync and it was
Assuming it was using ssh, does the winblows server have ssh servce on it?
> not responsive (left it on o
Steve Grazzini wrote:
> rmck wrote:
>> But I run this system call and it took allnight to run :(
>
> You were asking perl to rewrite the whole file for every line
> you wanted to change.
>
> #!/usr/bin/perl
> use strict;
> use warnings;# or just use Foo::Monkey :-)
>
>
> Hi
>
> This scripts sucks in a 109mb file and i'm trying to do a
> search and replace on unxtime to the format from strftime.
> Which is working...
>
> But I run this system call and it took allnight to run :(
>
> So I killed it... Any other suggestions to reach my goal.
>
>
Yes
On Jan 22, 2004, at 10:13 AM, rmck wrote:
Hi
Hello.
This scripts sucks in a 109mb file and i'm trying to do a search and
replace on unxtime to the format from strftime. Which is working...
But I run this system call and it took allnight to run :(
So I killed it... Any other suggestions to rea
rmck wrote:
But I run this system call and it took allnight to run :(
You were asking perl to rewrite the whole file for every line
you wanted to change.
#!/usr/bin/perl
use strict;
use warnings;# or just use Foo::Monkey :-)
use POSIX qw(strftime);
die "Usage: $0 FILES\n
Hi
This scripts sucks in a 109mb file and i'm trying to do a search and replace on
unxtime to the format from strftime. Which is working...
But I run this system call and it took allnight to run :(
So I killed it... Any other suggestions to reach my goal.
#!/usr/bin/perl
use strict;
Lol opps.
my $count = 0;
foreach ( @record ) {
my $length = length( $_ );
$widths[ $count ] = $length if ( $widths[ $count ] < $length );
$count++;
push ( @sheet, [ @record ] );
}
Paul Kraus
---
PEL Supply Company
Network Administrator
> --
On Jan 22, 2004, at 8:24 AM, Paul Kraus wrote:
This is a simple bit of code that scans through a file and determines
the
width setting for columns that will eventually be written out using
spreadsheet::writexcel. It works fine but I am curious if there is a
way to
do it with map or grep that wo
This is a simple bit of code that scans through a file and determines the
width setting for columns that will eventually be written out using
spreadsheet::writexcel. It works fine but I am curious if there is a way to
do it with map or grep that would be better? This is more for learning the
pract
I am transferring the data from a Redhat 9 machine to an IIS server run
by my ISP. I just tried running rsync and it was not responsive (left
it on overnight in fact to give it time to try). :(
Thanks!
Robert
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAI
Try pp (Perl Packager):
http://search.cpan.org/~autrijus/PAR-0.79/script/pp#NOTES
C:>pp -o our.exe our.pl
More info at:
http://par.perl.org/
HTH,
José.
-Original Message-
From: Shawn Sharp [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 9:06 PM
To: [EMAIL PROTECTED]
Subje
On Wed, 21 Jan 2004 19:32:56 -0300
"Marcelo" <[EMAIL PROTECTED]> wrote:
> Hi, could anyone recommend a good program to write code, currently using notepad.
If you are using Windows, there are a number of "Notepad" improved editors. Google for
"windows text editors" and you will get them all I gu
80 matches
Mail list logo