Visit Our UNIX and Linux User Community


one question of perl5


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users one question of perl5
# 1  
Old 04-16-2002
one question of perl5

I'm a chinese.I want to change the number $103,456 to chinese
>" ʰǪʰ½" user perl5!
> That always talk me it have errors"
>syntax error at uper line 25, near "If"
>syntax error at uper line 29, near "$chg("
>Execution of uper aborted due to compilation errors."
>it's seem that it error in syntax of 'if'
>but i don't know what's wrong!Can you help me?
Code:
>#!/usr/bin/perl
>@lab=("ʰ","","Ǫ","","ʰ","","Ǫ","");
>$flag1=0;
>$flag2=0;
>$flag3=0;
>$num=23;
>$var=23000;
>$st="";
>$strl="";
>$i=8;
>if($var>10000){
>                $flag3=1;
>               };
>for ($i>=0){
>      $temp=$var;
>      $var = $var%(10**$i);
>      $temp=$var - $temp;
>      $inter = $temp/(10**$i);
>      if (($i=4) && ($inter=0) && $flag3 ){
>                             $str = $str . ""
>                                            };
>If ($inter != 0){
>   If(Not $flag1){
>         $flag1=1;
>      If($flag2){
>         $strl.=$st;
>         $flag2=0;
>            }
>         $strl = $strl . $chg($inter) . $lab(i);
>                   };
>ElseIf ($flag1)
>      {
>    If (Not $flag2) { $flag2 = 1};
>      }
>$i=$i-1;
>}
>$strl = $strl . "Ԫ";
>
>sub chg{
>my($numb)=@_;
>if ($numb=1){ return "Ҽ"};
>if ($numb=2){ return ""};
>if ($numb=3){ return ""};
>if ($numb=4){ return ""};
>if ($numb=5){ return ""};
>if ($numb=6){ return "½"};
>if ($numb=7){ return ""};
>if ($numb=8){ return ""};
>if ($numb=8){ return ""};
>if ($numb=9){ return ""};
>if ($numb=0){ return ""};
>}

added code tags for readability --oombera

Last edited by oombera; 02-20-2004 at 02:05 PM..
# 2  
Old 04-17-2002
perl is case sensitive. Change your "If" statements to "if" instead. (lowercase the first letter). Same for "else" and "elseif".

Previous Thread | Next Thread
Test Your Knowledge in Computers #501
Difficulty: Easy
If a piece of code adds two numbers together and stores the result, there should be a comment that explains the process in the source code.
True or False?

7 More Discussions You Might Find Interesting

1. Linux

Installing perl5.14 failed

Hi, While installing perl5.14 on my Linux box its failing with c compiler issue. below is the error message. Use which C compiler? ./trygcc: line 10: cc: command not found Uh-oh, the C compiler 'cc' doesn't seem to be working. ./trygcc: line 25: gcc: command not found ./checkcc:... (11 Replies)
Discussion started by: muzaffar.k
11 Replies

2. Solaris

Wrong ELF data format: ELFDATA2MSB at /usr/perl5/5.8.4/lib/i86pc-solaris-64int/DynaLoader.pm

We are trying to install our project on solaris 10 x86 machine. we are getting the following error. Can't load '/u01/apps/WatchMark/FlexPM//R39FOA1/sw/perl/lib/auto/DBI/DBI.so' for module DBI: ld.so.1: perl: fatal: /u01/apps/WatchMark/FlexPM//R39FOA1/sw/perl/lib/auto/DBI/DBI.so: wrong ELF data... (3 Replies)
Discussion started by: Jagandadi
3 Replies

3. AIX

df question

Hi, Can anyone please explain a little about df command. I have following question: Following example is showing % used as 4 where as total free blocks are 15.46 out of 16.00 MB blocks. df -m /test Filesystem MBblocks Free %Used Iused %Iused ... (5 Replies)
Discussion started by: itsabhi9
5 Replies

4. UNIX for Dummies Questions & Answers

One question about ls(1)

Hi, When I see man page of different UNIX commands, I find something like this: ls(1), vi(1) etc. What is meant by (1) here? Can any body pls explain this. Regards, Tayyab (2 Replies)
Discussion started by: tayyabq8
2 Replies

5. UNIX for Dummies Questions & Answers

Problems installing perl5

Hi!! I have problems installing perl5 in a Tru64 4.0F enviroment, and i need it to install OpenSSL and OpenSSH to establis a SFTP... I'm installing perl 5.8.8 but an error occurr during make test, i ran ./perl harness and the result is the problem is on op/filetest.t I didn't know what to... (0 Replies)
Discussion started by: irasela
0 Replies

6. UNIX for Dummies Questions & Answers

question

hi guys.. I'm just wondering, everytime I go to a unix dictionary to get the definition of things such as $ and >& i dont get results back.. could you give me any link that has these simple definitions or could you tell me what $ means? or >&? (1 Reply)
Discussion started by: hamoudiii
1 Replies

7. Shell Programming and Scripting

sh script to traul through /usr/lib/perl5 ...

Hey, Im trying to create a script to create a dir-tree of pod converted to html. so far this is the script: #!/bin/sh cd /usr/lib/perl5 for d in ./* ; do # is it a dir? if ; then # yes! get the basename cd $d ; dir=`basename $d` for f in ./* ; do ... (1 Reply)
Discussion started by: emcb
1 Replies

Featured Tech Videos