Changing variables in place is usually a bad idea. It can be hard to debug and to modify, and it's a bit inflexible. I would rather write the code as such:
my $formatted_date = time_stamp( $date_created ) or warn "Invalid date: '$date_created'"; sub time_stamp { my $date = shift; return "$2/$3/$1" if $date =~ /(\d{4}(\d{2})(\d{2})/; }
In reply to Re: Dynamically changing the value of a passed variable into a sub
by chromatic
in thread Dynamically changing the value of a passed variable into a sub
by Willman023
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |