Ansys_120_CFX_官方教程.ppt

  1. 1、本文档共50页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Ansys_120_CFX_官方教程

Handles can also be external apps Perl can launch and interact with external processes System() spawns an external process and waits for it to finish Can open a command as a handle, and interact via STDIN. Command is executed when handle is closed. $logfile = “logfile.dat”; system(“grep -i error $logfile errors.dat”); open(SOLVER,|cfx5solve -def $myRun); close(SOLVER); #waits until done to continue External Processes Perl can use regular expressions for general text pattern matching and replacement Complex and ugly, but powerful print “Any last requests? ”; chomp($a = STDIN); if ($a =~ /^y/i) { # does the input begin with y print “What is it?”; STDIN; print “Sorry, I can’t do that.\n”; } print “Ready, aim, Fire !\n”; $string = “foot fool buffoon”; $string =~ s/foo/bar/g; # string is now “bart barl bufbarn” $line = “X,Y,Z,1,,1.234,34”; @fields = split(/\,/, $line); # @fields is (“X”,”Y”,”Z”,”1”,””,”1.234”,”34”) Regular Expressions Subroutines are just user defined functions. Declared with ‘sub’ Subroutines return one or more values from a return statement … or the value of the last statement if no explicit return. Invoked by calling subName(args) sub subName { statement 1; statement 2; [...] } $result = doSomething($a,$b); Subroutines Arguments are passed to a subroutine using the @_ list Must pass lists and arrays by reference sub addThreeNumbers { ($a, $b, $c) = @_; $result = $a + $b + $c; return $result; } Subroutines Use ‘\’ in front of a variable to create a scalar reference (pointer) $listRef = \@myList; De-reference by using a variable reference type ($, @ or %) push(@$listRef,”new Value”); Directly access elements in a reference using - notation For arrays: $listRef-[$index] For hashes: $hashRef-{$key} References sub printHash { ($hashRef) = @_; foreach $key (keys(%$hashRef)) { print “Key: $key, Value: “ . $hashRef-{$key} . “\n”; } } %myHash = (“a” = “b”, “c” = “d”); printHash(\%myHash); By def

文档评论(0)

ligennv1314 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档