Tommy Nordgren wrote:
> 
> This is my full script:
> #!/usr/bin/perl
> use strict;
> use warnings;
> 
> if ( @ARGV !=2) {
>     die "Usage: nibfixup Nibfile Applicationname\n" ;
> }
> 
> my $nibfile = $ARGV[0];
> my $appname = $ARGV[1];
> 
> print "Running nibtool\n";
> my $dictionary = `/usr/bin/nibtool -L $nibfile`;
> print "Nibtool have run\n";
> 
> my @dictionary = split(/\n/,$dictionary);
> 
> my $len = @dictionary;
> 
> print "lenght:$len\n";
> 
> open (DICT,'>','temp.strings') or die "Could not open dictionary file \n";
> 
> for my $i (@dictionary) {
>     my @i = split /=/ , $i;
>     if (1 == length @i) {

length() tests the length of *strings* NOT *arrays*.

@i in scalar context is the number of elements in @i so if:

@i = ( 'one', 'two' );

then:

2 == scalar @i;

So you are saying something like:

    if (1 == length '2') {


So your if statement will be true if @i contains zero to nine elements and
false if it contains ten or more elements.




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to