Perl system call

Posted by claferri on Stack Overflow See other posts from Stack Overflow or by claferri
Published on 2010-03-18T11:46:03Z Indexed on 2010/03/18 14:21 UTC
Read the original article Hit count: 448

Filed under:
|

I'm a beginner in Perl and I have some trouble using the "system" call. Here is a little piece of code where I try to execute 2 shell commands :

# First command is :
# dot -Tpng $dottmpfile > $pngfile
# Second command is :
# rm $dottmpfile

if (!($pngfile eq "")) {
  my @args = ("dot", "-Tpng", $dottmpfile, " > ", $pngfile);
  system (join (' ' , @args ))
    or die "system @args failed : $!";

  unlink $dottmpfile;
}

EDIT : Here is my code now, and I still get an error :

system dot -Tpng toto.dot  >  toto.png failed : Inappropriate ioctl for device at /home/claferri/bin/fractal.pl line 79.

I've used this to produce this piece of code.

© Stack Overflow or respective owner

Related posts about perl

Related posts about system