Perl : How to obtain epoch time
<p>I need a quick way to convert date <strong>"Tue Jul 02 17:50:55 MDT 2024"</strong> into epoch time.   </p>

<p>Effectively, I need the shell equivalent of <code>date -d "Tue Jul 02 17:50:55 MDT 2024" +%s</code>    </p>

<p>I currently use the following in perl but it requires a lot of conversion. Hoping to find a simpler and more elegant solution. </p>

<pre>
$current_epoch = timelocal($seconds, $minute, $hour, $day_of_month, $month_num, $year)
</pre>

<p>I currently use Perl 5.8 ; I dont believe it has "Time::Piece"<br>
I am only interested in solutions that do not require downloading another library</p>