Web Development

General discussion


perl script

By rjsaulakh ·
I have a log file of 10 MB size in which i have to find mac- address and there response status.what i do is first search through the file get all the mac -address and response status in a hash table . then i ask input from user for the mac address for which he want to see the response- status. the place where i require help is that how can i compare mac address and also how do i remove single quotes around a string

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by Jaqui In reply to perl script
Collapse -

by solrak29 In reply to perl script

# removing single quotes from a string

# here are some options depending on what you want
# removes all quotes
$quotedstring =~ s/\'//g;

# removes beginning and end quotes
$quotedstring =~ s/^\'//;
$quotedstring =~ s/$\'//;

# comparing mac addresses

# I believe there is a better command
# called exists or something like that.
# but defined should work.
if ( defined $machash{$userrequest} )
return $machash{$userrequest};

Related Discussions

Related Forums