so makeing out of these three lines, one?
my ($snummer, $maschinenname, $prozess) = (split(/;_,?/))[0,1,14];
$snummer = lc($snummer);
$maschinenname = lc($maschinenname);
Thomas
I'd expect a simple
my ($snummer, $maschinenname, $prozess) =
(split(/;_,?/, lc))[0,1,14];
should work just fine because your RE doesn't discriminate on upper or
lower case.
jue
That converts $prozess to lower case, which the original code doesn't.
I don't see a simple way to convert only $snummer, $maschinenname to
lowercase.
hp
You are right, my mistake. And because lc doesnt' accept a list as
argument I don't see any easy way, either. I guess you could try
something with map, but I seriously doubt it's worth the effort.
jue
my ($snummer, $maschinenname, $prozess) = split...;
$_ = lc for $snummer, $maschinenname;
is a least simpler than the original. For my taste I would want local
temporaries like that to have shorter names, as well.
Ben
> my ($snummer, $maschinenname, $prozess) = (split(/;_,?/))[0,1,14];
> $snummer = lc($snummer);
> $maschinenname = lc($maschinenname);
my ($snummer, $maschinenname, $prozess) =
grep{$_ = $c++<2 ? lc : $_}(split(/;_,?/))[0,1,14];
Marc
MG> On Dec 17, 11:57�am, Thomas Glanzmann <tho...@glanzmann.de> wrote:
>> my ($snummer, $maschinenname, $prozess) = (split(/;_,?/))[0,1,14];
>> $snummer = lc($snummer);
>> $maschinenname = lc($maschinenname);
MG> my ($snummer, $maschinenname, $prozess) =
MG> grep{$_ = $c++<2 ? lc : $_}(split(/;_,?/))[0,1,14];
that should be map. grep won't return the value if it is false and maybe
the split results has a null string in there.
also $c is undeclared and could be set to something other than 0 by
other code. so this is longer and noisier than it has to be.
uri
--
Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------