I do not understand regular expressions. That being said I have tried, but the "ah ha" moment when the syntax finally makes sense I still wait upon as I read tutorial after tutorial.
I've been working on a program to collect user data so that I can be lazy at work. I have to answer about 10 "Do you know where I forwared my mail to?" type questions and about 5 "Can you setup my account with a vacation message?" type questions per shift. It gets old fast; so I've got a script that will jump from server to server (using Net::SSH) looking at files and changing them depending on what I tell it to do. It works fine, but I have designs on making users use a non-root version from the web (Net::SSH::Perl so I can get their passwords and login as them) of it so they don't even have to ask me.
That being said I need to clean up the output a bit. So I was wondering about a regular expression that could match the following output.
cat: cannot open $HOME/$library::common{username}/filename
Can't open $HOME/$library::common{username}/filename
$HOME and $library::common{username} are scalars (well kinda) that hold data. I do not need to match their names, but instead what they contain.
I would much rather handle both of those cases in one regular expression then in two seperate if statements.
The best i have turned up so far is
if($vacation_str =~ /^.*$HOME\/$library::common{username}\/.vacation.m
+sg/i)
and it does not work. Tips anyone?
jcpunk
all code is tested, and doesn't work so there :p (varient on common PM sig for my own ammusment)