LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 02-23-2010, 11:36 AM   #1
shifter
Member
 
Registered: May 2006
Distribution: Slackware, DragonFly
Posts: 233

Rep: Reputation: 30
problem with return function value in perl


$val = mkdir $directory, 755
print $val;

does't create directory but return as value '0'

$val = 0 means true o false?
 
Old 02-23-2010, 11:52 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
should be
Code:
$val = mkdir $directory, 0755;
assuming $directory is defined beforehand.

true = 1
 
Old 02-23-2010, 11:04 PM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
I'd use this
Code:
mkdir($directory, 0755) or die "mkdir failed: msg was $!\n";
http://perldoc.perl.org/functions/mkdir.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get return value of function mortonmorton Linux - Newbie 4 10-09-2009 10:54 PM
Problem in checking function return value viveksnv Programming 3 10-02-2008 02:17 AM
return value of Clock function namanhams Programming 1 04-01-2008 01:00 PM
sh script: problem with return value in function jhwilliams Linux - Software 1 06-20-2007 12:47 PM
Perl exec function in linux (and system-function) nazula Programming 1 04-19-2004 01:21 PM


All times are GMT -5. The time now is 07:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration