Mike Burnard wrote:
>
> Hi,
Hello,
> I'm in the midst of writing my first useful perl script. It's designed to
> pull text out of a plain text file and write a xml plist.
>
> The only trouble I'm having (so far) is getting the text out the way I want
> it.
>
> The file I'm pulling data out of
- Original Message -
From: "Mike Burnard" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 30, 2002 11:40 PM
Subject: macthing question...
> Hi,
>
> I'm in the midst of writing my first useful perl script. It's designed to
> pull text out of a plain text file and wri
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 30, 2002 11:36 PM
Subject: Regexp with //x
>
> Can anyone tell me where to find out what the x does when used at the end
> of a pattern match? (i.e. $tag =~ /abc/x) Everywhere I've looked gi
On Mon, 30 Dec 2002, Mike Burnard wrote:
>
> The file I'm pulling data out of is formatted like this:
>
> 010 "red"
>
> 011 "diamond"
>
> 012 "lion"
>
> 010 "blue"
>
> 012 "blue whale"
>
> 011 "emerald"
>
> So, I've got this to get specific groups out at once:
>
> while () {
> if(/^010/) {
Interesting, I'm working on a similar thing.
I've found it useful to use the $1, $2, etc variables. So try something
like:
if( $line =~ /\"([\w\s]*)\"/ )
{
$array[i] = $1;
}
I'm not sure if all that (like the escaped ") is necessary; I'm just
starting myself.
On Mon, 30 Dec 2002, Mi
Hi,
I'm in the midst of writing my first useful perl script. It's designed to
pull text out of a plain text file and write a xml plist.
The only trouble I'm having (so far) is getting the text out the way I want
it.
The file I'm pulling data out of is formatted like this:
010 "red"
011 "diamo
Can anyone tell me where to find out what the x does when used at the end
of a pattern match? (i.e. $tag =~ /abc/x) Everywhere I've looked gives
me the helpful information that it means "Use extended regular
expressions," but I've yet to find a definition of what that *means*.
Thanks...
-
I takes the keys from the %hash and uses them to compare the the
data within the hash and since it is $b vs $a and not $a vs $b it is in
descending vs ascending sequence. For each key in %hash it then gets
assigned to key and you now have the key and data sored by value of the hash
and not
On Mon, Dec 30, 2002 at 10:10:50PM +0100, Adriano Allora wrote:
> 1 - Perl vs. AWK
> I'm learning Perl to use it in text processing. Recently I start to
> argue with a friend of mine about the best language to process texts
> (clear them, or markup them, tokenize them or parse them), he says awk
i have sorted the two-way communication stuff but no I am having trouble
doing the multithreaded version. I have no experience using fork or anything
to do with spawing or pid's.
Looking at the multithreaded server example on the sockets page on
perldoc.com, please could someone help me convert th
Hello /\/\ark,
Thanks for your reply. The below code does exactly what I wanted to do
and guess where did I get it ?! - perldoc -f sort !!!
%hash = (
"h" => 100,
"a" => 200,
"z" => 50,
"b" => 600
);
foreach $key ( sort { $hash{$b} <=> $hash{
$ perl -e '
%hash = (
"h" => 100,
"a" => 2000,
"z" => 50,
"b" => 600
);
for(sort { $hash{$b} <=> $hash{$a} } keys %hash) {
print $hash{$_}, " = $_\n";
}'
2000 = a
600 = b
100 = h
50 = z
HTH
"Rajendra Babu" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROT
It helps to answer your question if you show us what you've already done,
and tell us what you know...
perldoc -f keys
perldoc -f sort
/\/\ark
-Original Message-
From: Rajendra Babu, Praveen
[mailto:[EMAIL PROTECTED]]
Sent: Monday, December 30, 2002 3:16 P
%hash = (
"h" => 100,
"a" => 200,
"z" => 50,
"b" => 600
);
For the above %hash, I want to sort them by "values"(rather than keys) and
print-out the sorted key-value pair. Can it be done ??
The output needs to look like the below:
b 600
a 20
Hanson, Rob wrote:
Just because Awk shaves off a few seconds on a job doesn't make it better.
If that were the case we would all code directly in C.
Or assembly...ick
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
> 1 - Perl vs. AWK
> (my friend also forwarded me a mail of AWK
> mailing list in which someone who did a
> benchmark demonstrated the speed of awk...)
Did he benchmark the time it took to write it? :)
I'm not an authority on Awk, but it seems to me that Awk has one purpose,
and it isn't good at
Adriano Allora wrote:
hi to all,
I'd like to know two things:
1 - Perl vs. AWK
I'm learning Perl to use it in text processing. Recently I start to
argue with a friend of mine about the best language to process texts
(clear them, or markup them, tokenize them or parse them), he says awk
is be
hi to all,
I'd like to know two things:
1 - Perl vs. AWK
I'm learning Perl to use it in text processing. Recently I start to
argue with a friend of mine about the best language to process texts
(clear them, or markup them, tokenize them or parse them), he says awk
is better - quicker than perl,
Zentara wrote:
> On Thu, 12 Dec 2002 17:43:34 +0100, [EMAIL PROTECTED]
> (Olivier Moulene) wrote:
>
>>I have the pid of one running process and i want to kill it and all its
>>children. What can i do to know the pids of every children ?
>
> This untested code from perlmonks.org, it might give yo
"Michael Weber" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a script that listens on a port for a connection, receives some
> data over that connection, and writes it to a file.
>
> This works, but it takes up CPU cycles, RAM etc. when it waits. I am
It can probebly be done. I did something of this sort on my freebsd box. It
would probebly be more difficult, since perl probebly install's its dll's in
windows directory.
Mark
- Original Message -
From: <[EMAIL PROTECTED]>
To: "Craig Williams" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent
> But, it looks like he's just checking that $ARGV[0] is a directory. This
can
> be accomplished with a simple -d test.
...exactly. I used opendir because I find that sometimes flags fail on
windows machines. I think this is documented some where in the stat(),
having to do with NTFS.
Mark
- O
It should work, assuming you're not doing anything funky with installed
packages.
You might also look into Perl2Exe (http://www.indigostar.com/perl2exe.htm)
which bundles your Perl script and all necessary support files (aka
packages) into a single executable to be used for the purpose you describ
> -Original Message-
> From: Steve Few [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 30, 2002 11:34 AM
> To: [EMAIL PROTECTED]
> Subject: Directory help, AS
>
>
> [activeperl 5.6.1 NT]
>
> Folks.
>
> I have an 'error' question about lexical scoping.
>
> This is a followup to the
> -Original Message-
> From: Mat Harris [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, December 28, 2002 10:27 PM
> To: [EMAIL PROTECTED]
> Subject: two-way socket troubleshooting
>
>
> i have a client and server which I want to be able to have
> communicate in
> full-duplex. I need the cl
[activeperl 5.6.1 NT]
Folks.
I have an 'error' question about lexical scoping.
This is a followup to the Mark Goland's reply to help someone. I
have a question about an error I'm not familiar with using his
{opendir local} statement. After I run the below on my NT box, AS
build 622, I get:
'...
Both use and require will do the job. The @INC array by default includes the
current directory, '.', as its last entry, so you can split your program
into Perl modules in the same directory. 'use' is more appropriate as it
happens at compile time (whereas 'require' pulls the file in at run time).
'
might also want to turn on buffer flusing:
$|=1; # somewhere before the read operation, might want to use select to
make sure
# you ar working with the correct FH
> -Original Message-
> From: Mark Goland [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, December 29, 2002 10:52 PM
> To: Ma
Hi Craig,
Just put it in a file with a ./pm extension in the same directory as your calling
program, then use either the use or require statements:
file: rjnWeb.pm
in my program file:
use rjnWeb;
works like a charm on my ActivePerl on Win2k and on one of the unix servers I telnet
to. It does
Hi Anand,
Look at your logic:
until (($test ne 'Y') && ($test ne 'N') &&
($test ne 'y') && ($test ne 'n')) {...} #until BAD input
This says that as long as there is good input, keep cyckling until you get bad input.
You should either use while here, or change the condition to refle
Actually what I meant was, does the regex itself work.
If the regex structure is bad then using it in vars won't work either.
Always a good principle of programming :
If you can't do it dynamically make sure it works static.
Instead of trying to use(1|2) type you could create a hash fro
>
> I wrote this a while ago, it may give you some ideas.
well if you saw my post a week ago about my troubles with vec(), playing
with this will give me a chance to practice. thanks for the code, when i get
a free moment i will have some fun with the this bit twiddling gem :-)
seriously, this is
"Craig Williams" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I don't want to keep all my code for a script in one file.
>
> Do I have to use modules to break apart the code ? Is there anyway to just
> include a .pl file ? Modules used this way are a
> pain b
Because of the nature of the client OS, aka Win 2000, it should be capable since you
don't have to deal with differences in architectures, etc. You might check out the
active state project, if you haven't already. Sorry I can't be of more assistance but
I have very little experience with Windo
> Hi Kipp,
>
> I'd say don't bother pack()ing. At the moment, I think the
> function pretty much s**ks. use eval() instead. The
> following doesn't have that one-liner compactness of the
> others, but it shows you what is going on. The bitwise &
> does a real cute little trick with its ope
> > >
> > > $ perl -e 'printf "%vd\n", 192.168.1.1 & 255.255.0.0'
> > > 192.168.0.0
> > >
> >
> > quoting the string in anyway seems to break it. i am trying
> to read in the
> > strings from like this:
> > print "Enter the IP address: ";
> > $ip = ;
> > print "Enter the Subnet address: ";
> >
<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Are you guaranteed of a certain operating environment, that is, on the
customer side?
Yes. Always Windows 2000.
> http://danconia.org
>
>
>
> On Mon, 30 Dec 2002
Are you guaranteed of a certain operating environment, that is, on the customer side?
http://danconia.org
On Mon, 30 Dec 2002 02:44:55 -, "Craig Williams" <[EMAIL PROTECTED]> wrote:
> Sounds crazy I know but if I'm on a customers side with m
What you want is 'require'.
perldoc -f require
You should also check your books in the index for 'require' as this topic should be
covered, otherwise you might consider new books ;-)...
If you have the time you might also have a look at Find::Bin and consider developing
modules anyways...
htt
Sounds crazy I know but if I'm on a customers side with my CD of pl scripts
I don't want to have to install Perl on their
servers just to run my code. Can I just put the binary files on the CD and
run them ?
thanks
Craig
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-
You can't install mysql as a service on 98 so you must run the daemon from
the command prompt. Not even sure it works on 98 to start with.
C
"Patricia Hinman" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have set up mysql application server on my pc, and
>
I don't want to keep all my code for a script in one file.
Do I have to use modules to break apart the code ? Is there anyway to just
include a .pl file ? Modules used this way are a
pain because they must be put into /site/lib to work ..?
I have searched google and docs and even my books on perl
Anand Ramakrishna wrote:
>
>
> Hi,
Hello,
> I am a beginner to perl. I have written a simple program in Perl
> # This Program will copy the contents of a file named file.txt to another file
> # newfile.txt. If newfile.txt is already existing, the user is given an option
> # to overwrite the
On Mon, 30 Dec 2002, Anand Ramakrishna wrote:
> if (-e "newfile.txt")
> {
> print "WARNING !! FILE newfile.txt already exists\n";
> print "Do you want to destroy all the contents and overwrite the file\n";
> print "Type Y for Yes or N or NO\n";
> $test = ;
>
Hi,
I am a beginner to perl. I have written a simple program in Perl
# This Program will copy the contents of a file named file.txt to another file
# newfile.txt. If newfile.txt is already existing, the user is given an option
# to overwrite the file and chose a new file name to write the ou
45 matches
Mail list logo