w3b has asked for the wisdom of the Perl Monks concerning the following question:
I want to extract the subject from the e-mail but $1 is empty.... I don't know what i do wrong... Maybe Regexp or bad variable.#!/usr/bin/perl use warnings; use strict; use Net::POP3; my $time = scalar localtime; my $pop3 = "pop3.poczta.onet.pl"; my $login = "haptor\@op.pl"; my $pass = "*************"; my $pop = Net::POP3->new($pop3); my $res = $pop->login($login, $pass); if ($res eq "undef"){ print "Couldn't connect $!\n"; exit; } else { print "On $time e-mail status inbox: $res post \n"; } print "Write id(number) email to read:\n"; chomp(my $msgnum = <STDIN>); my $msg = $pop->get($msgnum); if($msg =~ /Subject:(.*)From:/){ #I think that there is a error here print "Subject is $1"; } $pop->quit();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with $1
by xdg (Monsignor) on Dec 03, 2005 at 14:40 UTC | |
by w3b (Beadle) on Dec 03, 2005 at 14:48 UTC | |
by fmerges (Chaplain) on Dec 03, 2005 at 20:53 UTC | |
|
Re: Problem with $1
by mulander (Monk) on Dec 03, 2005 at 14:36 UTC | |
by w3b (Beadle) on Dec 03, 2005 at 14:43 UTC |