diff --git a/functions.cpp b/functions.cpp
index 978d72f859665ffc4f4fce687d5f7c2826640ecc..c5e5eded8234419aadd9271ae84bfeb120014376 100644
--- a/functions.cpp
+++ b/functions.cpp
@@ -86,4 +86,31 @@ void saveCardsToFile(const std::list<Cards>& cardsList) {
     file.close();
 }
 
+//Aufgabe 5
+std::list<std::string> referenceNames(const std::string& referenceFile) {
+    std::ifstream file(referenceFile);
+    //check if file can be opened
+    if (!file) {
+        throw std::runtime_error("Error: Unable to open file " + referenceFile);
+    }
+    //output
+    std::list<std::string> namesList;
+    //temp for names
+    std::string name;
+    //read every line
+    while (std::getline(file, name)) {
+        namesList.push_back(name);
+    }
+
+    //close file
+    file.close();
+
+    //for testing reasons
+    std::cout <<namesList.front() << std::endl;
+    std::cout <<namesList.back() << std::endl;
+
+
+    return namesList;
+}
+
 
diff --git a/functions.h b/functions.h
index abdd52126f07fd476dce509dfce0ce26cced4b58..0cdcbfb43e2a62fe0bea5ec669930b0f13014988 100644
--- a/functions.h
+++ b/functions.h
@@ -10,6 +10,7 @@
 
 std::list<Cards> getListOfCards(const std::string& filename);
 void saveCardsToFile(const std::list<Cards>& CardsList);
+std::list<std::string> referenceNames(const std::string& referenceFile);
 
 
 
diff --git a/main.cpp b/main.cpp
index 509aacdc8b2e7452aa8a9ae6639dd1775ed52bc2..1bd7891969afe667205a09a94c93c9e8089b7a8a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -25,6 +25,8 @@ int main() {
     test = getListOfCards("/Users/erayduzenli/CLionProjects/magicCards/scrambled.txt");
     //TODO why does it save the file in the debug folder
     saveCardsToFile(test);
+    referenceNames("/Users/erayduzenli/CLionProjects/magicCards/reference.txt");
+
 
     return 0;
 }