Identify function image magick problem - perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Identify function image magick problem - perl
# 1  
Old 09-21-2011
Identify function image magick problem - perl

Hi, I got some error when I try to write content from file store into array then for each word that separate by space use identify function to display image information.here is my code

Code:
#!/usr/bin/perl -w

open(FILE,'transfer_file_perl.txt') or die "$!";
my $line = <FILE>;#because it is one line you read it into a scalar
close FILE;
my @array = split(/ /, $line);
foreach my $i (0..$#array)
{
    identify $array[$i];
}

here is content in transfer_file_perl.txt
Code:
4.jpg 3.jpg 2.jpg 5.jpg

When tested
Code:
$ perl test4.pl
Can't call method "identify" on an undefined value at test4.pl line 9.

# 2  
Old 09-21-2011
Quote:
Originally Posted by guidely
Hi, I got some error when I try to write content from file store into array then for each word that separate by space use identify function to display image information.here is my code

Code:
#!/usr/bin/perl -w
 
open(FILE,'transfer_file_perl.txt') or die "$!";
my $line = <FILE>;#because it is one line you read it into a scalar
close FILE;
my @array = split(/ /, $line);
foreach my $i (0..$#array)
{
    identify $array[$i];
}

here is content in transfer_file_perl.txt
Code:
4.jpg 3.jpg 2.jpg 5.jpg

When tested
Code:
$ perl test4.pl
Can't call method "identify" on an undefined value at test4.pl line 9.

What does "transfer_file_perl.txt" look like?
What are the elements of @array?
What does the method/subroutine "identify" do?

tyler_durden
# 3  
Old 09-21-2011
perl is not shell, you can't run the 'identify' external command just by typing 'identify'.

How about system("identify " $array[$i]);
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Identify problem with while getopts

can anyone spot a problem with the below: $ $ cat getopts.sh #!/bin/sh usage() { echo "myscript.sh local /tmp data.txt 600s -query" 1>&2; exit 1; } while... (4 Replies)
Discussion started by: SkySmart
4 Replies

2. Shell Programming and Scripting

Perl -> Identify Values

Hi, I tried to find out the users under the file /etc/shadow , where the value should be 90, which shouldn't be less or more than that.. if its more or less, it should give me the output as BAD. { print (GOOD); } Else { print (BAD); } (10 Replies)
Discussion started by: gsiva
10 Replies

3. Shell Programming and Scripting

Problem of Perl's "join" function

$ perl -e '@f=("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","1","911"); print join("\t",@f)."\n";' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ... (5 Replies)
Discussion started by: carloszhang
5 Replies

4. Shell Programming and Scripting

Problem in passing date to external function from perl script.

my $sysdate = strftime('%Y-%m-%d', localtime ); biDeriveByDate('Table_Str',$sysdate,\@lIndx,\@lResVals) In a perl script, when I'm trying to pass $sysdate to some external function it's not working since $sysdate is passed as a string mentioned above but my function is expecting a date value... (1 Reply)
Discussion started by: Devesh5683
1 Replies

5. Shell Programming and Scripting

Perl Script to identify files without extension and assign a value

Hi, I have a perl script which is a part of a shell script which read lines from a flat file(which is generated as part of a script after a series of bteq/fexp) and assigns a value for each object in the file based on the type of file name. (i.e extensions like .bteq/.ctl/.ksh etc) For example,... (1 Reply)
Discussion started by: yohasini
1 Replies

6. Shell Programming and Scripting

perl Image::size function

Hi, How to use Image::size function ? because I want to list all image thatare less than size pixels in horizontal resolution. so here is my code : #!/usr/bin/perl -w use Image::Size; use constant GIVEN_WIDTH = '100'; my @filtered_images = grep { my @d = imgsize( $_ ); $d < GIVEN_WIDTH }... (8 Replies)
Discussion started by: guidely
8 Replies

7. Shell Programming and Scripting

How to identify a corrupted TIFF image

Hi everyone! Here's my first thread... I have to recognize if a TIFF image is corrupted or not. I've always usedfile -b to identify file type, but I've experienced that sometimes it returns "TIFF image data, little endian" even if the image is truncated or something. Do you know another trick... (6 Replies)
Discussion started by: canduc17
6 Replies

8. Shell Programming and Scripting

Problem with timegm function in perl

Hello.. In my code i use the following function: $epochTime = timegm($sec, $min, $hour, $day, $month, $year) The problem is that when $day==31, i get the following error: Day '31' out of range 1..30 at unrated_namp_program line 113 Any idea how to overcome this??? Thank you very... (5 Replies)
Discussion started by: chriss_58
5 Replies

9. Shell Programming and Scripting

identify function

Does anyone know a shell command that identifies the functions from a C file? Thank you (7 Replies)
Discussion started by: xinfinity
7 Replies

10. Shell Programming and Scripting

PERL function problem

I have perl script as follow. ------------------------------------------------------------------------ #! /usr/bin/env perl use strict; sub printLines { print "Inside the function.............\n"; my (@file , $count , $key ) = $_; print $count , $ key ; #... (2 Replies)
Discussion started by: avadhani
2 Replies
Login or Register to Ask a Question