Hello,
I've just made a simple script using xml::simple,
and I am stuck on something:
I have an xml file that looks like this:
person
address
strSomewhere/str
nr18/nr
sca/sc
/address
/person
person
address
strSomewhere else/str
nr3/nr
sca/sc
zonebc/zone
Guys, I've got a script that collects mail and puts into a variable. How
do I search this for a line containing Price: and then take the value
of price:? Price: and it's value are the only thing on this line. Below
is the script I have.
#!/usr/bin/perl -w
# This script was created by David
U can use module XML::Parser
- -Original Message-
- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
- Sent: Monday, July 25, 2005 2:46 PM
- To: beginners@perl.org
- Subject: xml::simple
-
-
-
- Hello,
-
- I've just made a simple script using xml::simple,
- and I am stuck on
On Jul 25, 2005, at 11:15, [EMAIL PROTECTED] wrote:
Hello,
I've just made a simple script using xml::simple,
and I am stuck on something:
I have an xml file that looks like this:
person
address
strSomewhere/str
nr18/nr
sca/sc
/address
/person
person
address
#Get and process mail
for my $messageID (1 .. $numofmail){
my $MFH = $pop3server-getfh($messageID);
my $text = '';
Indent those two :)
$text .= $_ while $MFH;
my ($price) = $text =~ m/Price\:(.*)/;
}
#Exit
exit();
Why do you call exit here?
--
To unsubscribe, e-mail: [EMAIL
http://www.ka9q.net/puzzle/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
here is the snippet from the code:
...
my $selectHandle = $dbh-prepare(...);
...
$selectHandle-execute();
my @data = $selectHandle-fetchrow_array();
$self-[1] = \$data;
and another one:
---
...
my $selectHandle = $dbh-prepare(...);
...
On Jul 25, Denis N. said:
my $selectHandle = $dbh-prepare(...);
...
$selectHandle-execute();
my @data = $selectHandle-fetchrow_array();
$self-[1] = \$data;
That should be [EMAIL PROTECTED], not \$data.
my $selectHandle = $dbh-prepare(...);
...
$selectHandle-execute();
$self-[1] =
hi ,
I am a perl newbie.
Can someone suggest a perl command line snippet that will print the last n
lines of a file.
thanks in advance.
regards,
Kaushik
Notice: The information contained in this e-mail message and/or attachments to
it may contain confidential or privileged
On Mon, 25 Jul 2005 21:39:50 +0800, [EMAIL PROTECTED] wrote:
Can someone suggest a perl command line snippet that will print the last
n
lines of a file.
If you are under unix/linux
just use tail -n command.
However if you really want to go via Perl command line:
$perl -e '
open FH, file
hi ,
I am a perl newbie.
Can someone suggest a perl command line snippet that will print the last n
lines of a file.
thanks in advance.
regards,
Kaushik
Kaushik,
If you are on the command line I suggest the use of the tail command.
tail -n 123 filename
If you must perform this
Edward WIJAYA wrote:
On Mon, 25 Jul 2005 21:39:50 +0800, [EMAIL PROTECTED] wrote:
Can someone suggest a perl command line snippet that will print the
last n
lines of a file.
If you are under unix/linux
just use tail -n command.
However if you really want to go via Perl command
I am just learning about making and using my own packages and moduals
I have a CGI that requires a package.
the package is a subroutine that is called on in the main program(CGI)
The subroutine works fine as a sub in the main program.
but when I put it in a package, it does not work.
I thought
[EMAIL PROTECTED] wrote:
hi ,
I am a perl newbie.
Can someone suggest a perl command line snippet that will print the last n
lines of a file.
Why do you want a Perl line for that?
You could just use 'tail' (assuming you run some kind of UNIX).
Matthias
--
To unsubscribe, e-mail:
Luinrandir am Montag, 25. Juli 2005 21.42:
I am just learning about making and using my own packages and moduals
I have a CGI that requires a package.
or: uses
the package is
a subroutine that is called on in the main program(CGI)
The subroutine works fine as a sub
...defined...
in
On Jul 25, [EMAIL PROTECTED] said:
Can someone suggest a perl command line snippet that will print the last n
lines of a file.
The File::ReadBackwards module does it for you rather simply.
--
Jeff japhy Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the
Dave Adams wrote:
Larsen,
Hi Dave. My name is Errin. Larsen is my surname.
Please, when posting replies, post to the list.
I am afraid I cannot get your suggested code to work. Especially
line that reads foreach reverse 0..$n;
SNIP
On 7/25/05, Larsen, Errin M HMMA/Information
I'm trying to send a multipart mail message using MIME::Lite.
I have a number of DB queries and write(append) the results as we run
through them to a text file. After all this is done, I want to send an
email with a text message containing these results as well as an
attached tarball.
I can do
Looking at the documentation, it looks like what you want is the Data
field when you initialize your message.
Data = whatever;
-Original Message-
From: Charles Farinella [mailto:[EMAIL PROTECTED]
Sent: Monday, July 25, 2005 1:50 PM
To: Perl Beginners
Subject: MIME::Lite message text
Hallo again
BTW I am referencing
Perl, read less learn more Pg170 to 177
ok I found one problem... I did not have
package::subroutine();
in the main program... now it works, sorta...
I need to pass data to and from the packages.
Question 1:
should this be a package.pl or a modual.pm?
Question
On Mon, 2005-07-25 at 16:46, Tim Johnson wrote:
Looking at the documentation, it looks like what you want is the Data
field when you initialize your message.
Data = whatever;
That's true, but what I need is either:
Data = whatever_filename;
or
Data = the results of about 6
On Jul 25, Luinrandir said:
Question 1:
should this be a package.pl or a modual.pm?
If you want to be able to source the file via the
use ModuleName;
then the file must end in '.pm'.
Question 2:
so I need to
require 'package.pl';
but
use 'modual.pm';
The syntax is
use ModuleName;
How hard would it be to create a temporary variable where you store the
contents of the file?
my $data;
open(INFILE,my_file.txt) or die Couldn't open file for reading!\n;
while(INFILE){
$data .= $_;
}
# OR ###
while(my $ref = $sth-fetchrow_hashref()){
$data .=
Ok.. thats what I thought...
thanks Lou
.. in my 5 year mission to wrap my brain around perl.
- Original Message -
From: Jeff 'japhy' Pinyan [EMAIL PROTECTED]
To: Luinrandir [EMAIL PROTECTED]
Cc: beginners@perl.org
Sent: Monday, July 25, 2005 2:27 PM
Subject: Re: Package/modual question
[EMAIL PROTECTED] wrote:
hi ,
Hello,
I am a perl newbie.
Can someone suggest a perl command line snippet that will print the last n
lines of a file.
perl -ne'INIT{$#x=shift()[EMAIL PROTECTED](splice(@x,1),$_)[EMAIL PROTECTED]' 4
yourfile
John
--
To unsubscribe, e-mail: [EMAIL
try:
perl -ne '$line=$_;END{print $line}' yourfile
On Mon, 25 Jul 2005 19:09:50 +0530
[EMAIL PROTECTED] wrote:
hi ,
I am a perl newbie.
Can someone suggest a perl command line snippet that will print the last n
lines of a file.
thanks in advance.
regards,
Kaushik
Notice:
I find these a lot on email and I know it's some encoding problem somewhere.
How are you supposed to handle this so things come out clean?
besides doing this:
$message =~ s/=20//sg
(or was it 'm', I'll have to look it up)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
All this came from one error.
I usually get one line of goo from a die statement.
How did he get so much wonderful information?
Can't call method body on an undefined value at
/usr/share/perl5/Email/MIME/Modifier.pm line 244 (#1)
(F) You used the syntax of a method call, but the
Tom Allison mailto:[EMAIL PROTECTED] wrote:
: All this came from one error.
: I usually get one line of goo from a die statement.
: How did he get so much wonderful information?
Place this at the top of the script.
use diagnostics;
Though I would suggest also adding strictures. I'm
On Jul 25, Tom Allison said:
I find these a lot on email and I know it's some encoding problem somewhere.
How are you supposed to handle this so things come out clean?
besides doing this:
$message =~ s/=20//sg
(or was it 'm', I'll have to look it up)
Well, the /m and /s modifiers are useless
Hi all.
I need the fastest ( ie runtime ) possible way to get an image's
dimensions, and it needs to work on Windows ( without too much mucking
around, too ). It needs to work with png and jpg images - anything else
is a bonus.
I was thinking about using ImageMagick, but I'm not sure if that
On Jul 26, Daniel Kasak said:
I need the fastest ( ie runtime ) possible way to get an image's
dimensions, and it needs to work on Windows ( without too much mucking
around, too ). It needs to work with png and jpg images - anything else
is a bonus.
Well, there's Image::Size on CPAN...
--
32 matches
Mail list logo