perl - How to avoid empty elsif? -



perl - How to avoid empty elsif? -

the below code want, tells me, empty elsif not practice. purpose create sure $type either snap or fs, alter $t if snap.

my $t = ""; if ($type eq "snap") { $t = "-t snapshot"; } elsif ($type eq "fs") { } else { fatalerror("must either snap or fs") }

question

how do same, without empty elsif?

how about:

my $t = ""; if ($type eq "snap") { $t = "-t snapshot"; } elsif ($type ne "fs") { fatalerror("must either snap or fs") }

perl

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -