in reply to Splitting SPICE lines on 'word' boundries closest to a certain length
Here I create a flag to detect the first line:
my $spice_str = "VIN IN VSS PWL ( 0ns 0.0 4ns 2.4 25ns 0.0 50ns 2.4 51 +ns 0.0 75ns 2.4 76ns 0.0 100ns 2.4 101ns 0.0 )"; my $rest = $spice_str; my @text; my $first = 1; while ( $rest ne '' ) { $rest =~ /(.{1,25}[^a-zA-Z0-9.])/; push @text, ($first ? $1 : "+$1"); $rest = $'; $first = 0; } foreach ( @text ) { print "$_\n"; }
-Mark
|
|---|