Quick actions

cmd+k|ctrl+k

Navigation

Languages

List generator

Snippet info

Language

Perl

Visibility

public

Author

smonff

Created

2020-01-14T15:25:47Z

Updated

2020-01-14T15:33:10Z

use strict;
use warnings;
use feature 'say';

chomp( my @items = <DATA> );

# Pour configurer le nom de la liste
my $list_name = 'MA_SUPER_LISTE';
generate_list( { questions => \@items , list => $list_name } );

sub generate_list {
  my $params = shift;
  while ( my ( $index, $question ) = each( @{ $params->{ questions }} )) {
    $index += 1;
    my $string =
      'ADD ( "'.
      $params->{ list } .
      '", '.
      $index .
      ' ) if VALUE( "'.
      $question .
      '" ) == 1';
    say $string;
  }
}

# À laisser en bas
__DATA__
S411_18
S411_17
S41_20
S41_19
S41_18
S41_17
S41_16
S41_15
S41_14
S41_13
S41_12
S41_11
S41_10
S41_9
S41_8
S41_7
S41_6
S41_5
S414_8
S414_7
S414_6
S414_5
S414_4
S414_3
S414_2
S414_1
S411_1
S411_2
S411_3
S411_4
S411_5
S411_6
S411_7
S411_8
S411_9
S411_10
S411_11
S411_12
S411_13
S411_14
S411_15
S411_16
S412_1
S412_2
S412_3
S412_4
S412_5
S412_6
S412_7
S412_8
S412_9
S412_10
S413_1
S413_2
S413_3
S413_4
S413_5
S411_19
INFO