Instantly convert code snippets from F# to Perl with our free online code converter. Transform your code easily and accurately.
Experience the full potential of AI-driven code conversion and transformation!
We prioritize your code's security and privacy. Your code is not stored on our servers and is only temporarily processed for conversion. We use OpenAI's secure servers for the conversion process, ensuring your code remains confidential.
F# is a functional-first programming language that makes it easy to write correct and maintainable code.
Perl is a family of two high-level, general-purpose, interpreted programming languages.
open System
let isPalindrome (str: string) =
let clean = String.Join("", str.ToLower().ToCharArray()
|> Array.filter Char.IsLetterOrDigit)
clean = String(clean.ToCharArray() |> Array.rev)
# Example usage
printfn "%b" (isPalindrome "A man, a plan, a canal: Panama") // true
printfn "%b" (isPalindrome "race a car") // false
sub is_palindrome {
my $str = shift;
$str =~ s/[^a-zA-Z0-9]//g;
$str = lc($str);
return $str eq reverse($str);
}
# Example usage
print is_palindrome("A man, a plan, a canal: Panama") ? "true\n" : "false\n";
print is_palindrome("race a car") ? "true\n" : "false\n";
let bubbleSort (arr: int array) =
let n = Array.length arr
for i in 0 .. n - 1 do
for j in 0 .. n - i - 2 do
if arr.[j] > arr.[j + 1] then
let temp = arr.[j]
arr.[j] <- arr.[j + 1]
arr.[j + 1] <- temp
arr
let arr = [|64; 34; 25; 12; 22; 11; 90|]
bubbleSort arr |> Array.iter (printf "%d ")
sub bubble_sort {
my @arr = @_;
my $n = scalar @arr;
for my $i (0..$n-1) {
for my $j (0..$n-$i-2) {
if ($arr[$j] > $arr[$j+1]) {
@arr[$j,$j+1] = @arr[$j+1,$j];
}
}
}
return @arr;
}
my @arr = (64, 34, 25, 12, 22, 11, 90);
print join(" ", bubble_sort(@arr)) . "\n";
Convert F# to Python
Open ConverterConvert F# to JavaScript
Open ConverterConvert F# to TypeScript
Open ConverterConvert F# to Java
Open ConverterConvert F# to C
Open ConverterConvert F# to C++
Open ConverterConvert F# to C#
Open ConverterConvert F# to Go
Open ConverterConvert F# to Dart
Open ConverterConvert F# to Ruby
Open ConverterConvert F# to Swift
Open ConverterConvert F# to Kotlin
Open ConverterConvert F# to Rust
Open ConverterConvert F# to Scala
Open ConverterConvert F# to PHP
Open ConverterConvert F# to R
Open ConverterConvert F# to Haskell
Open ConverterConvert F# to Julia
Open ConverterConvert F# to MATLAB
Open ConverterConvert F# to Lua
Open ConverterConvert F# to Assembly
Open ConverterConvert F# to Groovy
Open ConverterConvert F# to Elixir
Open ConverterConvert F# to Clojure
Open ConverterConvert F# to Delphi
Open Converter