# timestamp examples
use strict;
use warnings;
use v5.10.0;
use POSIX qq(strftime);
my $timestamp = strftime("%Y-%m-%d_%a_%H-%M-%S",localtime);
say $timestamp; # 2021-06-08_Tue_11-54-28
# ------------------------------------------------------------------------------
use DateTime;
my $today = DateTime->today();
say $today; # 2021-06-08T00:00:00
say $today->date; # 2021-06-08
Showing posts with label Perl. Show all posts
Showing posts with label Perl. Show all posts
Tuesday, June 8, 2021
Formatting Time and Date with Perl
Wednesday, November 4, 2020
Extensions for Perl in VS Code
Extension for Perl that work reasonably well in Visual Studio Code
- Better Perl Syntax
- better Perl syntax highlighting
- Perl (cfgweb)
- Code intelligence for Perl
- Perl::Tidy (doesn't seem to work)
- Perl Debug
- Integrated debugger for Perl
- Perl Toolbox
- Linting
- perlcritic
- Documents are only checked on open or save
Wednesday, May 1, 2019
Perl - get the script path
# C:\Foo\Bar\my_script.pl use strict; use warnings; use FindBin qw($Bin); print "My script lives in $Bin\n"; # My script lives in C:/Foo/Bar
Note that there is no trailing slash, and Windows back-slashes '\' are converted to forward slashes '/'
Tuesday, September 11, 2018
Perl: How to capture a regex match in one line
my ($match) = "some string" =~ /(some).*/; print $match; # prints "some"
Subscribe to:
Posts (Atom)