Eric Krause wrote:
Hello all,

Hello,

I have two quick questions that I would love some help on. I have looked at the manual (Programming Perl) and I didn't get it, hence my email.

Question 1 - How can I make variables in a function (subroutine) global (accessible from other functions)?

Any variable defined outside of and before the subroutine is accessible from inside the subroutine.


Question 2 - I am trying to control the actions of a program through an email; i.e. change the basic parameters by sending an email to a specific address. Can anyone suggest what regex would get me xxxxxx and y(y) if the subject line of the email looks like:

Subject: 123456 9       or    Subject: 123456 10

The 10 in the line above can be a 1 or 2 digit number. The 6 digit number right after the 'Subject:' is an employee number and the 1 or 2 digit number after it is the hours worked.

if ( /^Subject:\s+(\d+)\s+(\d+)/ ) {
    ( $employee, $hours ) = ( $1, $2 );
    }



John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to