On 04/25/2021, at 00:34, @lbutlr <[email protected] <mailto:[email protected]>> 
wrote:
> On 19 Apr 2021, at 21:46, Christopher Stone <[email protected] 
> <mailto:[email protected]>> wrote:
>> use v5.010;
> 
> Excellent script, but is this needed? And what are the consequences if you 
> have 5.32 installed?


Hey Lewis,

Thank you.

No, use v5.010; is not required in this case.

It does not designate the Perl version used per se – it does designate the 
lowest possible version of Perl that can be used.

I frequently set the lowest version to 5.010, because it allows `say` to be 
used in addition to `print`.  (Without the use statement `say` will throw an 
error.)

You can run this to demonstrate to yourself that your current Perl version is 
the one being used.


#!/usr/bin/env perl -sw
use v5.010;

print "Perl $^V\n";


Appended is a slight mod of my script – I hadn't made the strip vertical 
whitespace code global, and under certain circumstances that could lead to an 
extra linefeed between a couple of dialog blocks.

I also added a regex to normalize the spacing between dialog blocks just for 
good measure.

--
Best Regards,
Chris


#!/usr/bin/env perl -0777 -nsw
# 
--------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2012/11/27 08:12
# dMod: 2021/04/26 00:07
# Task: Sort CC Script Segments for a Video.
# Tags: @ccstone, @Shell, @Script, @CC, @Sort, @Video
# 
--------------------------------------------------------------------------------
# use v5.010;

s!^LOGGER\h*\d+\h*!!gim;        # Remove “Logger ##” lines if necessary.
s!^\h+|\h+$!!gm;                # Remove trailing whitespace on every line.
s!\n{2,}!\n\n!gm;               # Normalize spacing between script blocks.
s!\A\s+|\s+\Z!!g;               # Remove leading and trailing vertical 
whitespace.
my @array = split(/\n\s+/, $_); # Split script segments into an array.
chomp(@array);                  # Remove trailing linefeeds from records.
@array = sort(@array);          # Sort array.
$, = "\n\n";                    # Set Output Field Separator.
print @array;                   # Print array.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/52CE3E18-17C3-4AB1-AE8E-7C1F0DDAD191%40gmail.com.

Reply via email to