http://www.perlmonks.org?node_id=1111789


in reply to Re^2: Simple http server one-liner for some static files?
in thread Simple http server one-liner for some static files?

Joining the "better late than never"-motto, here a (long) one-liner which—in constrast to the answers before—does not require non-core modules:
perl -MHTTP::Daemon -e '$d = HTTP::Daemon->new(LocalPort => 8000) or +die $!; while ($c = $d->accept) { while ($r = $c->get_request) { +$c->send_file_response(".".$r->url->path) } }'
Actually this is a flattened and slightly modified version of HTTP::Daemon's synopsis section.