On Jul 4, 3:46 am, [EMAIL PROTECTED] (Daluk) wrote:
> I have a some code that reads in a file, and then i have some if
> statements. The if statement i want to change is
>
> if (($DeviceType eq "Switch") || ($DeviceType eq "Router") ||
> ($DeviceType eq "Hub") || ($DeviceType eq "Access point"))
>
> what i would like to do is check each device type with where the first
> letter is uppercase or lowercase
>
> i have tried a few regex syntax but i'm not getting there :(
Why do you need regexps?
> any advice for a beginner please
perldoc -f ucfirst
if ( ucfirst($DeviceType) eq 'Switch'
|| ucfirst($DeviceType) eq 'Router'
|| ucfirst($DeviceType) eq 'Hub'
|| ucfirst($DeviceType) eq 'Access point' ) {
#do stuff
}
(this is one of many different ways of accomplishing your goal.
TIMTOWTDI)
Paul Lalli
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/