1. <GALiRe> 2. 3. <title>Break AScript<end title> 4. 5. <% 6. 7. %hash = (ABBA=1,BEENIE=2,COOLIO=3,); 8. 9. if (%hash) { 10. reverse(%hash); 11. add(DARUDE=4,) to(%hash); 12. %hash=lcfirst(%hash)kv; 13. print join(%hash)k + "<new>"; 14. 15. %hash = replace(/ab/)i with("la") in(%hash); 16. print replace("laba")i with("DABBA") in(%hash); 17. 18. } 19. 20. 21. $x=6; 22. @tempSto = (rand(100),70,75,80); 23. 24. @mdAry = ((5,4,$x,8),10); 25. if (@mdAry) { 26. @mdAry[2] = (50,20); 27. @mdAry[3] = @tempSto; 28. @mdAry[3][2] = 36; 29. @mdAry[1]++; 30. 31. add(60) to(@mdAry); 32. add(64,19,30) to(@mdAry[3]); 33. 34. @tempTemp = ((77,33,22,55,11)); 35. add(@tempTemp) to(@mdAry); 36. } 37. 38. @arry="@mdAry[0]@mdAry[3]"; 39. print "<line>@arry<line>"; 40. 41. print "<new>@mdAry<new>"; 42. print "@mdAry[2]<new>"; 43. print "@mdAry[3]<new>"; 44. print "@mdAry[3][2]<new><new>"; 45. 46. @mdAry[3] = replace(/[8-9]/)g with(3) in(@mdAry[3]); 47. sort(@mdAry[3]) by("numbers"); 48. reverse(@mdAry[2]); 49. 50. print @mdAry; 51. 52. print "<new>" + join(@mdAry) by("x"); 53. 54. print "<line>"; 55. 56. @textArry = (('HAPPY','SAD'),('OVEREMOTIONAL','SENSITIVE'),'DUMB',('JUBILATED','TRUMPED'),'STUFFED','DUMB'); 57. 58. @textArry = replace("dumb")i with("THUMB") in(@textArry); 59. 60. print "@textArry<new><new>"; 61. 62. print indexOf(/um/)i in(@textArry) + " " + lastIndexOf(/um/)i in(@textArry) + "<new>"; 63. 64. 65. ($happy,$sad) = @textArry[1]; 66. print "$happy and $sad<new>"; 67. 68. while (@tmpArray[4][3] = @textArry) {print "@tmpArray<new>";} 69. 70. print "<line>"; 71. 72. while ($first = @textArry) {print "$first<new>";} 73. 74. print "<line>"; 75. 76. while (?tmpArray = @textArry) { 77. if (?tmpArray eq 2) { 78. while ($tmpArray = @tmpArray) { 79. print "ary > txt $tmpArray<new>"; 80. } 81. } else {print "txt $tmpArray<new>";} 82. print "<new>"; 83. } 84. 85. %> 86. 87. <line> 88. 89. <?Server 90. 91. @decmAry = ((5.12,3.14,9.56),(10.62,1.93),4.63); 92. print round(@decmAry[0]) to(1) + "<new>"; 93. 94. print (5 > 1 && @mdAry[1] eq 11?greater:less); 95. 96. 97. ?> 98. 99. <line> 100. 101. <% 102. 103. @txtAry = ("happy","good","great","worse","worst","best","happy","happy"); 104. print length(select("happy") from(@txtAry)); 105. print " " + length(select(/APP/)i from(@txtAry)); 106. 107. %txtHash = (mood = "happy",feel = "good",sub = "great",level="worse",sup ="happy",); 108. 109. print "<new>"; 110. 111. print sort(select(keys) from(%txtHash)); 112. print " and " + sort(select(values) from(%txtHash)); 113. 114. print "<new>"; 115. 116. print select(/OO/)kiv from(%txtHash); 117. 118. print "<new>"; 119. 120. print @txtAry[1] beginsWith(/GO/)i; 121. print b(@txtAry[1] /GO/)i; 122. 123. print "<new>"; 124. 125. print @txtAry[1] endsWith(/OOD/)i; 126. print e(@txtAry[1] /OOD/)i; 127. 128. print "<new>"; 129. 130. print @txtAry contains("good"); 131. print c(@txtAry "good"); 132. 133. print "<new>"; 134. 135. print @txtAry lacks("good"); 136. print l(@txtAry "good"); 137. 138. print "<new>"; 139. 140. print %txtHash contains(/MOO/)i; 141. print " " + %txtHash contains(/GOO/)vi; 142. print " -- " + %txtHash lacks(/MOO/); 143. print " " + %txtHash lacks(/GOO/)i; 144. 145. print "<new>"; 146. 147. print random(@decmAry[0]); 148. 149. print "<new>"; 150. 151. @txtAry = ("aaa=happy","bbb=good","ccc=great","ddd=worse","eee=happy"); 152. print split(@txtAry) by("="); 153. 154. print "<new>"; 155. 156. @decmAry=""; 157. /* inappropriate, use () instead of ""*/ 158. 159. print @decmAry; 160. 161. print "<new>"; 162. 163. $smash = "Run: to (Suzie);"; 164. print replace("s")g with("YXYX") in($smash); 165. 166. 167. 168. /*$xtc="ZXNRBL is the best!";*/ 169. 170. /*print replace(1) with("A") in($xtc) + "<new>";*/ 171. 172. /*print replace(1) with("A") in(@txtAry);*/ 173. 174. print "<line>"; 175. 176. print rand(8-9); 177. 178. print "<new>"; 179. 180. @array=(1,2,3,4,5,6,7,8,5,4,3); 181. print remove(duplicates) from(@array); 182. print @array; 183. 184. %hash = (x=1,y=2,z=3,a=1,b=4); 185. print "<new>[" + remove(duplicates) from(%hash) + "]"; 186. print %hash; 187. 188. print "<new>[" + remove(duplicates) from($smash) + "]"; 189. print $smash; 190. 191. 192. if (open("xtc.txt") as(#FH)) { 193. print "<new>INSIDE"; 194. add("A","A","A","B","Carlos","is great") to(#FH); 195. print #FH; 196. remove(duplicates) from(#FH); 197. print #FH; 198. close(#FH); 199. %dataHash = info("xtc.txt"); 200. print %dataHash[size] + "<new>"; 201. } 202. 203. 204. if (open("xtc.txt") as(#FA)) { 205. #FA = "happy"; 206. print #FA; 207. reset(#FA); 208. print #FA; 209. #FA = ""; 210. print #FA; 211. close(#FA); 212. } 213. 214. %dataHash = info("xtc.txt"); 215. print %dataHash[size]; 216. 217. 218. print "<line>"; 219. 220. print lc(join(split("HEY HEY HEY") by(" ")) by(":")); 221. 222. $x10=@txtAry; 223. print "<new>" + $x10 + "<new>"; 224. 225. if (@txtAry[0] eq /aaa.*happy/) {print "Goodie!";} 226. 227. print "<new>"; 228. 229. $y=" man"; 230. $y =+ "happy"; 231. print $y; 232. 233. $y=5; 234. $y += 3; 235. print $y; 236. 237. print "<new>"; 238. 239. print ++$y; 240. print $y++; 241. print $y; 242. 243. print "<new>"; 244. 245. %hash =+ %txtHash; 246. print %hash; 247. 248. print "<new>"; 249. 250. 251. @test1=(1,2,3,4,5,1); 252. @test2=(3,4,5); 253. print @test1 contains(@test2); 254. print c(@test1 @test2); 255. print " -- " + @test1 lacks(@test2); 256. print l(@test1 @test2); 257. 258. print "<new>"; 259. 260. print compare(@test1) and(@test2); 261. 262. print "<new><new>"; 263. 264. %test1=(a=1,b=2,c=3,d=4,); 265. %test2=(b=1,c=2,d=4,e=5,); 266. print contrast(%test1)kv and(%test2); 267. 268. print "<new><new>"; 269. 270. print ucfirst("welcome"); 271. print lcfirst("WELCOME"); 272. 273. print "<new><new>"; 274. 275. while ($key = %test1) { 276. print "$key = %test1[$key] : "; 277. } 278. 279. %> 280. 281. <line> 282. 283. <% 284. 285. print length(@(1,2,3,4,5,6)); 286. while ($x = @(1,2,3,4,5,6)) { 287. print "$x<new>"; 288. } 289. 290. %> 291. 292. </GALiRe>
Back to /SampleHost/